Open Bug 1703470 Opened 4 years ago Updated 4 years ago

Consider adding a cache for GetterSetter instances

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

People

(Reporter: jandem, Unassigned)

References

Details

Since bug 1700052 we store getter/setter objects as a GetterSetter tuple. We should measure how common it is to create duplicate GetterSetter instances; a full hash map may not be worth the perf/memory overhead, but maybe a 1-slot (or few slots) cache could pay off for the case where the same accessor property is defined on multiple objects (or on the same object with different property keys).

I did some quick measurements. Loading a number of popular websites, out of 205,000+ GetterSetters we created, only a handful are identical to one created recently. More than 97% of them are unique.

This is based on comparing JSObject* pointers so not entirely correct due to (moving) GC, but it's probably a close enough estimate.

You need to log in before you can comment on or make changes to this bug.