[Webkit-unassigned] [Bug 99118] JSC Should atomize constant strings before handing them to WebCore

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 12 13:14:32 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=99118





--- Comment #8 from Oliver Hunt <oliver at apple.com>  2012-10-12 13:15:14 PST ---
(In reply to comment #6)
> (In reply to comment #5)
> > JSC does intern all string literals in source code.  I'm unsure how feasible sharing jsc's interned strings with AtomicString is (multiple JSC contexts have separate interned strings for the same literal for example).  Also it would require some communication between JSC and WebCore of the sort that would be easier if we weren't having to deal with two JS engines.
> 
> For what it's worth, I believe v8 has the same bug.
> 
> > That said, what strings are we seeing that aren't being atomised?
> 
> The case is that "*" or "div" or whatever the author has specified is correctly being Interned (as you noted above), but then that same Interned StringImpl is being handed to getElementsByTagName, getElementById, etc. every time.  Since that StringImpl is not marked isAtomic(), we do a hash-lookup to find the corresponding Atomized StringImpl (which is slow):
> http://trac.webkit.org/browser/trunk/Source/WTF/wtf/text/AtomicString.h#L176
> 
> A win here would either be to have JSC use the same underlying StringImpl as WebCore (or vice-versa), or to have some fancy way to map between them.
> 
> One possible fix might be to pre-warm JSC's unique StringImpl table with the ones from WebCore?

StringImpl's are unique per JSC-heap, which isn't a guarantee that they're unique in the context of the DOM.  We could maybe fix that for commonJSGlobalData, but that feels fragile.


What I was wanting to know is how many unique strings end up missing the cache hit (i mean non-Atomic strings coming from JS)?

Some stats on what those strings are just accumulated via printf logging into a histogram.

Depending on the spread I have an idea for a way to greatly improve the lookup speed even on a miss, when the string is already present in the Atomics table.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list