Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(712)

Issue 2192293002: StringBuilder::append should not use reserveCapacity. (Closed)

Created:
4 years, 4 months ago by esprehn
Modified:
4 years, 4 months ago
Reviewers:
haraken, Yuta Kitamura
CC:
blink-reviews, blink-reviews-wtf_chromium.org, chromium-reviews, Mikhail
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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 Committed: https://crrev.com/25fdbad21c66328e5ada9b9b436d3a8c146ca728 Cr-Commit-Position: refs/heads/master@{#408869}

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -3 lines) Patch
M third_party/WebKit/Source/wtf/text/StringBuilder.cpp View 1 chunk +1 line, -3 lines 0 comments Download

Messages

Total messages: 14 (9 generated)
esprehn
4 years, 4 months ago (2016-07-29 22:03:14 UTC) #5
haraken
LGTM
4 years, 4 months ago (2016-07-30 04:51:17 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2192293002/1
4 years, 4 months ago (2016-07-30 07:33:00 UTC) #11
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years, 4 months ago (2016-07-30 07:37:21 UTC) #12
commit-bot: I haz the power
4 years, 4 months ago (2016-07-30 07:38:42 UTC) #14
Message was sent while issue was closed.
Patchset 1 (id:??) landed as
https://crrev.com/25fdbad21c66328e5ada9b9b436d3a8c146ca728
Cr-Commit-Position: refs/heads/master@{#408869}

Powered by Google App Engine
This is Rietveld 408576698