Summary: | StringBuilder often creates two StringImpls. | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Andreas Kling <kling> | ||||
Component: | Web Template Framework | Assignee: | Andreas Kling <kling> | ||||
Status: | REOPENED --- | ||||||
Severity: | Normal | CC: | benjamin, cdumez, cmarcelo, commit-queue, kling, simon.fraser | ||||
Priority: | P2 | Keywords: | Performance | ||||
Version: | WebKit Nightly Build | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Attachments: |
|
Description
Andreas Kling
2016-01-03 01:25:45 PST
Created attachment 268134 [details]
Proposed patch
Here's one way of making this better: adjusting the length field of the buffer and then returning it as the final string. This way we keep the slightly oversized buffer allocation, but don't allocate an extra StringImpl.
Comment on attachment 268134 [details] Proposed patch Clearing flags on attachment: 268134 Committed r194510: <http://trac.webkit.org/changeset/194510> All reviewed patches have been landed. Closing bug. This broke the windows build: C:\cygwin\home\buildbot\slave\win-debug\build\Source\WTF\wtf\text\StringBuilder.cpp(63): error C2248: 'WTF::StringImpl::m_length': cannot access private member declared in class 'WTF::StringImpl' [C:\cygwin\home\buildbot\slave\win-debug\build\WebKitBuild\Debug\Source\WTF\wtf\WTF.vcxproj] It also broke two tests: Tests that failed: StringBuilderTest.Append StringBuilderTest.ToStringPreserveCapacity Reverted r194510 for reason: Broke 2 API tests, no time to investigate right now Committed r194519: <http://trac.webkit.org/changeset/194519> |