[webkit-dev] UString/StringImpl changes

David Levin levin at chromium.org
Mon Jan 5 15:55:32 PST 2009


I was hoping to discuss some UString/StringImpl changes with someone
familiar with this area.

My goals were

   - be able to share a UString across threads without doing any memory
   copies.
   - do not increase the size of UString/StringImpl
   - make their performance no worse in the common case (as measured by
   SunSpider).
   - be able to create a String from a UString without allocations and
   copying a new buffer for the underlying string (I heard that this was
   desired.)

My change seems to make SunSpider run about *1-2% faster *and use the *same
or less memory *for UString.  For an extreme example, SmallStringStorage
went from ~13K to ~7k.

I would like to ensure that this approach seems ok (and get
some initial feedback).  Here's the patch so far:
    http://pastebin.com/m4fdac1d6
One issue: (As ap suggested to me), I think my String::String(UString&)
change is incorrect.  The shared ownership of the underlying point should
probably be the result of an explicit parameter to a String constructor.

Thanks,
Dave

PS In case you're wondering what happened as a result of my last emails.
 This change is to support the "inspector calls from XHR running in a
(html5) worker".

PPS I didn't file a bug for this yet because I felt like this change was
still a bit in the design phase (rather than patch ready phase).  If a bug
is the right way to go at this early-ish stage. I can do that in the future.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090105/778e22bb/attachment.html>


More information about the webkit-dev mailing list