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

Issue 2617173003: [url] Reserve output buffer for various URL parsing paths (Closed)

Created:
3 years, 11 months ago by Charlie Harrison
Modified:
3 years, 11 months ago
Reviewers:
brettw
CC:
chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[url] Reserve output buffer for various URL parsing paths This patch moves buffer reservation to the internals of //url code, whereas previously this was the caller's (e.g. GURL, KURL) responsibility. The reason for this change was that KURL was *not* doing any buffer reservation, so a naive exponential buffer growth algorithm was being used. Rather than expecting all callers to be bug free, this patch opts to always do the right thing. For a ~1.5MB data URL, this yields a ~13% improvement of DoCanonicalizePathComponent<char, unsigned>, which translates to a ~8% improvement for the overall KURL::init. BUG=657978 Review-Url: https://codereview.chromium.org/2617173003 Cr-Commit-Position: refs/heads/master@{#444558} Committed: https://chromium.googlesource.com/chromium/src/+/96b890e58809d310e0b70029913e0f72a00a4414

Patch Set 1 #

Patch Set 2 : scheme #

Patch Set 3 : do what brettw suggests #

Patch Set 4 : Just comments / formatting (trybots prev) #

Patch Set 5 : more comment #

Total comments: 4

Patch Set 6 : brettw review #

Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -23 lines) Patch
M url/gurl.cc View 1 2 5 chunks +0 lines, -21 lines 0 comments Download
M url/url_canon.h View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
M url/url_canon_relative.cc View 1 2 3 4 5 4 chunks +15 lines, -2 lines 0 comments Download
M url/url_util.cc View 1 2 3 4 5 3 chunks +13 lines, -0 lines 0 comments Download

Messages

Total messages: 27 (14 generated)
Charlie Harrison
Brett, is this reasonable? I think huge data URLs are where we'd appreciate this optimization ...
3 years, 11 months ago (2017-01-06 20:29:50 UTC) #6
brettw
I think it's a good idea to be reserving appropriate space. But I think we ...
3 years, 11 months ago (2017-01-07 23:20:00 UTC) #9
Charlie Harrison
SGTM I'll try that.
3 years, 11 months ago (2017-01-07 23:53:32 UTC) #10
Charlie Harrison
Ok! Here's an updated patch which moves all size reservation into internal url parsing code. ...
3 years, 11 months ago (2017-01-09 18:03:36 UTC) #14
Charlie Harrison
Brett: friendly ping
3 years, 11 months ago (2017-01-18 17:21:42 UTC) #15
brettw
Sorry!
3 years, 11 months ago (2017-01-18 20:50:49 UTC) #17
brettw
https://codereview.chromium.org/2617173003/diff/80001/url/url_canon_relative.cc File url/url_canon_relative.cc (right): https://codereview.chromium.org/2617173003/diff/80001/url/url_canon_relative.cc#newcode291 url/url_canon_relative.cc:291: std::max(path.end(), std::max(query.end(), ref.end())) + 32); You copied "32" from ...
3 years, 11 months ago (2017-01-18 21:12:28 UTC) #18
Charlie Harrison
Thanks for the review, no worries about the slowness I sorta forgot about this one ...
3 years, 11 months ago (2017-01-18 21:30:38 UTC) #19
Charlie Harrison
oh, and PTAL
3 years, 11 months ago (2017-01-18 21:31:06 UTC) #20
brettw
lgtm
3 years, 11 months ago (2017-01-18 21:32:41 UTC) #21
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/2617173003/100001
3 years, 11 months ago (2017-01-18 21:34:29 UTC) #23
commit-bot: I haz the power
Committed patchset #6 (id:100001) as https://chromium.googlesource.com/chromium/src/+/96b890e58809d310e0b70029913e0f72a00a4414
3 years, 11 months ago (2017-01-19 00:14:15 UTC) #26
Charlie Harrison
3 years, 11 months ago (2017-01-19 20:36:04 UTC) #27
Message was sent while issue was closed.
This patch misses something key:
For callers that choose to pre-allocate their canon outputs, this patch
regresses performance because we immediately copy everything over into a +8
sized buffer (if the caller didn't use any extra padding).

I'll upload a patch addressing this by only adding the +8 buffer if we need to
resize.

Powered by Google App Engine
This is Rietveld 408576698