DescriptionStringBuilder::append should not use reserveCapacity.
reserveCapacity allocates the exact capacity specified which means
when we had a 16bit buffer in StringBuilder and were appending 8bit
strings to it we were constantly reallocating and copying the buffer.
Instead we can just call Vector::append() directly since it has a
template overload that can accept implicitly convertible types.
I noticed this when looking at lever.co's web app loading in
Instruments, it was spending 15% of the main thread time inside
TextResource::decodedText which was 83% memmove, and 11% munmap.
Switching to Vector::append should restore the correct size
doubling behavior when appending LChars to a UChar StringBuilder
and make this much faster.
This was a regression from when I switched to using a Vector
inside StringBuilder in:
https://codereview.chromium.org/2046353002
Committed: https://crrev.com/25fdbad21c66328e5ada9b9b436d3a8c146ca728
Cr-Commit-Position: refs/heads/master@{#408869}
Patch Set 1 #
Messages
Total messages: 14 (9 generated)
|