Open Bug 1892945 Opened 2 years ago Updated 1 year ago

Optimize add-element code in AddOrUpdateSparseElementHelper

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

People

(Reporter: jandem, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: perf)

Olli shared a GDocs profile where we're spending a fair amount of time adding sparse properties under AddOrUpdateSparseElementHelper: https://share.firefox.dev/4bpRGlt

Longer-term the right fix for this is bug 1339265, but short-term we could try replacing the AddOrChangeProperty call with a fast path for adding a dense or sparse element. The object is either a plain object or an array, so we don't need the generic add-property-hook call but could instead inline it for arrays similar to the fast path in CallAddPropertyHookDense. There's also some property descriptor overhead we could avoid on this fast path.

Flags: needinfo?(jdemooij)
Blocks: sm-jits
Severity: -- → N/A
Priority: -- → P3

Clearing the NI as I'm not currently working on this. Also, looking at this again, we do need a lot of the code in AddOrChangeProperty so I'm not sure how much it'd improve performance. It might be better to look at the JS code that's using these sparse arrays to see if we can avoid going sparse.

Flags: needinfo?(jdemooij)
You need to log in before you can comment on or make changes to this bug.