DescriptionRelease the buffer in StringBuilder::toString() and toAtomicString().
Various places in the code like FetchDataLoader and WorkerScriptLoader
keep a StringBuilder as a data member to buffer data and then call
toString() on it later. By clearing the buffer in the string conversion
methods we avoid having two copies of the values in memory persistently.
This restores the behavior from before I switched it to a Vector in
https://codereview.chromium.org/2046353002 where toString() and
toAtomicString() would always clear the buffer when converting to a
string because they called reifyString.
While I haven't been able to confirm this is the cause, this seems a
possible candidate for the small regression on system health benchmarks.
It's also just generally better behavior since it avoids an accidental
2x memory increase from a StringBuilder member.
This also makes appending individual characters cheaper by removing the
branch from resetting m_string every time.
BUG=633197
Committed: https://crrev.com/e5dd14ac89435d384867f678106374f471dd414a
Cr-Commit-Position: refs/heads/master@{#418437}
Patch Set 1 #Patch Set 2 : Make m_string and m_buffer exclusive to each other. #
Total comments: 4
Messages
Total messages: 16 (8 generated)
|