[webkit-reviews] review requested: [Bug 67081] Basic enhancements to StringBuilder : [Attachment 107317] patch v3

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 14 04:20:13 PDT 2011

Xianzhu Wang <wangxianzhu at chromium.org> has asked  for review:
Bug 67081: Basic enhancements to StringBuilder

Attachment 107317: patch v3

------- Additional Comments from Xianzhu Wang <wangxianzhu at chromium.org>
After comparing the cost, I chose to use AtomicString(toString()) and
AtomicString(toStringPreserveCapacity()) in toAtomicString() and
toAtomicStringPreserveCapacity() respectively.

If they don't use toString() and toStringPreserveCapacity(), they still need
shrinkToFit() (for toAtomicString()) and something like reifyString() (but
without constructing a String). The difference is whether
String::String(StringImpl*) or String::String(PassRefPtr<StringImpl>) will be
called. The costs of the constructors are trivial, just like those of the
constructors of RefPtr and PassRefPtr. The cached m_string might also benefit
in some cases.

AtomicString(characters(), m_length) can get a fit-sized independent buffer,
but I don't see obvious benefits of it.

More information about the webkit-reviews mailing list