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

Issue 2235113002: Use StringView for String::append and ::insert. (Closed)

Created:
4 years, 4 months ago by esprehn
Modified:
4 years, 4 months ago
Reviewers:
haraken, Yuta Kitamura
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-wtf_chromium.org, chromium-reviews, dglazkov+blink, eric.carlson_apple.com, feature-media-reviews_chromium.org, gavinp+loader_chromium.org, haraken, Nate Chapin, loading-reviews+fetch_chromium.org, Mikhail, mlamouri+watch-blink_chromium.org, rwlbuis, tyoshino+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use StringView for String::append and ::insert. This avoids allocating temporary strings when calling this method with a literal string. I also simplified the code by merging the code paths. Since StringAppend can't implicitly convert to StringView we can no longer write: string.append(stringA + stringB) or string.append(stringA + "foo") since the result of the + operator (a StringAppend object) is not allowed anymore. Doing this actually caught a bunch of callers which were allocating temporary strings trying to build up a bigger string and should be using StringBuilder instead. For example extractWebGLContextCreationError was allocating a huge number of temporary strings. BUG=615174 Committed: https://crrev.com/f10ca9328c07c6bddfe281336072d5650a533dfc Cr-Commit-Position: refs/heads/master@{#411285}

Patch Set 1 #

Patch Set 2 : Fix appendHex stuff. #

Messages

Total messages: 22 (16 generated)
esprehn
4 years, 4 months ago (2016-08-11 05:24:44 UTC) #13
haraken
LGTM Would it make sense to rename String::append to something like String::appendSlow to encourage people ...
4 years, 4 months ago (2016-08-11 05:28:43 UTC) #14
esprehn
On 2016/08/11 at 05:28:43, haraken wrote: > LGTM > > > Would it make sense ...
4 years, 4 months ago (2016-08-11 05:30:54 UTC) #16
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/2235113002/20001
4 years, 4 months ago (2016-08-11 05:31:21 UTC) #19
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 4 months ago (2016-08-11 07:43:27 UTC) #20
commit-bot: I haz the power
4 years, 4 months ago (2016-08-11 07:46:05 UTC) #22
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/f10ca9328c07c6bddfe281336072d5650a533dfc
Cr-Commit-Position: refs/heads/master@{#411285}

Powered by Google App Engine
This is Rietveld 408576698