[Webkit-unassigned] [Bug 90247] Use StringBuilder in SegmentedString::toString()
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Jun 28 23:06:30 PDT 2012
https://bugs.webkit.org/show_bug.cgi?id=90247
--- Comment #3 from Kwang Yul Seo <skyul at company100.net> 2012-06-28 23:06:29 PST ---
(In reply to comment #2)
> (From update of attachment 150082 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=150082&action=review
>
> > Source/WebCore/ChangeLog:9
> > + Use a StringBuilder instead of String concatenation because StringBuilder is generally faster.
> > + No new tests. Covered by existing tests.
>
> Does this actually make things faster? If so, by how much?
The only caller of SegmentedString::toString is XMLDocumentParser::append(const SegmentedString&). This method retrieves parseString from the argument s as in the following:
void XMLDocumentParser::append(const SegmentedString& s)
{
String parseString = s.toString();
...
if (m_parserPaused) {
m_pendingSrc.append(s);
return;
}
...
}
Because callers of XMLDocumentParser::append usually pass a String, the SegmentedString s usually consists of a single String. In this case, this patch might not improve performance.
However, if the parser is paused, s is appended to m_pendingSrc. When the parser is resumed, m_pendingSrc is appended again. Now we have a SegmentedString with multiple substrings. I guess this patch improves the performance in this case.
I admit this is a micro optimization, so I am not sure if I can measure the performance improvement in a statistically valid method.
If StringBuilder with a single append performs worse than a Single string concatenation, I am skeptical of this being a noticeable improvement
--
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