Closed Bug 1808673 Opened 2 years ago Closed 2 years ago

Investigate if MruCache would be useful for atom cache

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
111 Branch
Tracking Status
firefox111 --- fixed

People

(Reporter: smaug, Assigned: smaug)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [sp3])

Attachments

(1 file)

https://bugzilla.mozilla.org/show_bug.cgi?id=1799628#c4

Gecko side uses MruCache in couple of places on top of a hashtable to avoid slow hashtable accesses. It might be useful on Spidermonkey side too?

MruCache lives currently in xpcom/ds but could be of course moved to some better place if needed. And it is a very simple class, so for testing one can just copy it to wherever.

The cache is now also used from JIT code (bug 1807159). If we can improve the hit rate without bloating JIT code too much, this might be worth investigating. In local testing back then I saw the hit rate drop off fairly quickly for sizes >= 2 though.

Blocks: 1801189
Priority: -- → P3

It is that the current cache is for exact JSLinearStrings. The cache that is used in Gecko is to avoid slow hashtable lookups.
I was playing around with this a bit and the wip patch (just copy-paste MRUCache for now to JS) that I'm about to upload reduces hashtable lookups about 33% when running sp2 react-todo.

Blocks: 1811749
Blocks: 1803803
No longer blocks: 1801189
Depends on: 1812753
Attachment #9313447 - Attachment description: WIP: Bug 1808673 - Investigate if MruCache would be useful for atom cache → WIP: Bug 1808673 - Add MruCache for short strings in StringToAtomCache, r=jandem
Attachment #9313447 - Attachment description: WIP: Bug 1808673 - Add MruCache for short strings in StringToAtomCache, r=jandem → Bug 1808673 - Add MruCache for short strings in StringToAtomCache, r=jandem
Assignee: nobody → smaug
Status: NEW → ASSIGNED
Duplicate of this bug: 1811749
Pushed by opettay@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5b90fc9fed42 Add MruCache for short strings in StringToAtomCache, r=jandem
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 111 Branch
Regressions: 1815366
Whiteboard: [sp3]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: