StringBuilder::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 Review-Url: https://codereview.chromium.org/2192293002 Cr-Commit-Position: refs/heads/master@{#408869}
Showing
Please register or sign in to comment