Closed Bug 1862459 Opened 2 years ago Closed 11 months ago

Stable hashing of symbols of used as weak map keys is inefficient

Categories

(Core :: JavaScript: GC, task, P5)

task

Tracking

()

RESOLVED DUPLICATE of bug 1863391

People

(Reporter: jonco, Unassigned)

References

Details

To allow symbols to be used as weakmap keys we extended weakmaps to allow JS values containing GC things as keys. (This uses GC thing pointer equality and not JS value semantics. )

Stable hashing is used for all GC thing pointers regardless of whether they can move. Symbols in particular are allocated in the atoms zone and can never move so this is wasteful for the one other GC thing kind we care about here. For symbols we can hash the raw pointer.

This feature isn't enabled by default yet so this is not high priority.

Symbols and atoms also contain a HashNumber. For atoms this was added at some point because there were some security issues when we hashed the pointer; I'm not sure if the same thing applies to symbols.

We now use the Symbol's dedicated hash property since bug 1863391.

Status: NEW → RESOLVED
Closed: 11 months ago
Duplicate of bug: 1863391
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.