Open Bug 1844394 Opened 1 year ago Updated 1 year ago

Object.keys should be able to create a for-of cache if necessary

Categories

(Core :: JavaScript Engine: JIT, enhancement, P2)

enhancement

Tracking

()

People

(Reporter: mgaudet, Assigned: mgaudet)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3])

In Bug #1839437 we gave Object.keys the ability to use the for-of cache to great effect. However, this requires an object to be iterated through for-of first to populate this cache.

It would be helpful if Object.keys being used repeatedly on the same object was able to fill in said cache.

I have a janky patch here that needs some cleanup and evaluation but will have to be tomorrow.

Assignee: nobody → mgaudet

So, in Speedometer 3 we were spotting that this was working sometimes, but failing in some cases. For example, in the Speedometer shell branch (f339d7b13ff4dd8933555bba55963427d27d17fe), react-redux see 40414 attempts, 1 successes for a hit rate of 0.002474%.

I have this very preliminary patch to enable the creation of the cache. On react-redux this makes our success rate 99.990102%, at a cost of the patch initializing the cache 8 times (out of 40414 attempts).

You would think that this would provide some actual speedup... and yet: Local testing shows effectively no change in performance. A push to try shows medium confidence win of ~1%, but regressions of 4% on some other benchmarks .

On react-redux, despite the number of calls, when I profile the benchmark I get only 15 out of 880 samples in obj_keys

I find myself very skeptical it would be worth adding the complexity here to cleanup this patch

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