Closed Bug 773520 Opened 12 years ago Closed 12 years ago

Add a cache for mapping stringbuffers to JS external strings

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla18

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

If we had such a beastie, we could handle repeated attempts to JS-wrap the same stringbuffer by just lookup and returning the JSExternalString. The finalizer we use for JSExternalString could remove from the hashtable as needed.
Blocks: 772466
This would be similar to JSStringCache used in JSDOMBinding.h Which was added in https://bugs.webkit.org/show_bug.cgi?id=33768
Attached patch Instrumentation patch (deleted) — Splinter Review
I loaded gmail, zimbra, New York Times, a few other websites I can't recall, Google Reader. There are about 65000 entries. Of those, about 500 are during browser startup.
Attached file Analysis script (deleted) —
Assuming I didn't screw anything up, this should measure hit and miss rates for a one-slot cache and a hashtable. And those are: Slot hits: 12155 misses: 20369 Cache hits: 21845 misses: 10679 So even the one-slot cache ends up hitting more than 37% of the time. I vote we just do that. ;)
Summary: Add a hashtable mapping PRUnichar* to JS external strings → Add a cache for mapping stringbuffers to JS external strings
Assignee: nobody → bzbarsky
Whiteboard: [need review]
Comment on attachment 642183 [details] [diff] [review] This shaves another 15ns off a typical getAttribute call. There's still more gunk in the string-wrapping code (e.g. several levels of function calls), unfortunately. Review of attachment 642183 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me, sorry for the delay.
Attachment #642183 - Flags: review?(bhackett1024) → review+
Comment on attachment 642183 [details] [diff] [review] This shaves another 15ns off a typical getAttribute call. There's still more gunk in the string-wrapping code (e.g. several levels of function calls), unfortunately. Review of attachment 642183 [details] [diff] [review]: ----------------------------------------------------------------- Don't forget to replace NULL with nullptr.
Attachment #642183 - Flags: review?(peterv) → review+
Flags: in-testsuite-
Whiteboard: [need review]
Target Milestone: --- → mozilla18
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: