Open Bug 1953749 Opened 8 months ago Updated 8 months ago

Free weak map storage during background finalization for JS WeakMap objects

Categories

(Core :: JavaScript: GC, enhancement, P2)

enhancement

Tracking

()

People

(Reporter: jonco, Assigned: jonco)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Found while working on bug 1952626.

Currently we clear and compact dead weak maps during weakmap sweeping, which frees the map storage. This happens with the mutator paused. Instead, where the weakmap is owned by a JSObject we can rely on the finalizer to delete the weakmap, which happens during background finalization with the mutator running.

Unfortunately this makes the test case in bug 1952626 about 10% slower, likely due to lock contention when allocating/freeing memory. For real world use cases this is probably an improvement though.

In future we may be able to make weakmaps use the buffer allocator for storage which would make this a win in all cases.

Severity: -- → N/A
Priority: -- → P2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: