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

Issue 2428093002: [KURL] Avoid re-hashing input if is already canonicalized (Closed)

Created:
4 years, 2 months ago by Charlie Harrison
Modified:
4 years, 1 month ago
Reviewers:
haraken, esprehn
CC:
blink-reviews, chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[KURL] Avoid re-hashing input if is already canonicalized KURL will re-hash the raw canonicalized output and check the AtomicStringTable (addWithTranslator) for the string. This can be very expensive for large URLs. However, since many URLs are generated from existing AtomicStrings (which already have their hashes computed), we can use a fast path and just return the input if it was already canonicalized and hashed. This optimization shaves 25% off the overhead of loading 1mb data url images (if the data url is properly canonicalized). Data from profiling results on Linux. BUG=348655, 657978 Committed: https://crrev.com/495bfff108b8c1b2f67bfbd0a7fffceb436b31f8 Cr-Commit-Position: refs/heads/master@{#430166}

Patch Set 1 #

Patch Set 2 : comment + AtomicString #

Total comments: 2

Patch Set 3 : fix comment typo (trybots prev) #

Total comments: 2

Patch Set 4 : fix threaded parser, random refactoring #

Patch Set 5 : lets just go wild and see what happens (remove isUnusedPreload() check) #

Patch Set 6 : uh ignore PS 5 I have no idea how that got there :P #

Total comments: 4

Patch Set 7 : Major tweaks, CheckedNumeric #

Patch Set 8 : null check :P #

Total comments: 6

Patch Set 9 : esprehn review: use clampTo and tweak comment #

Patch Set 10 : remove <limits> #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+37 lines, -28 lines) Patch
M third_party/WebKit/Source/platform/weborigin/KURL.h View 1 2 3 4 5 6 1 chunk +0 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/platform/weborigin/KURL.cpp View 1 2 3 4 5 6 7 8 9 3 chunks +37 lines, -23 lines 2 comments Download

Messages

Total messages: 49 (32 generated)
Charlie Harrison
haraken, WDYT? BTW the benchmark came from loading 100 XHRs with data URLs. There may ...
4 years, 2 months ago (2016-10-18 19:26:10 UTC) #8
haraken
I think Elliott is the best reviewer for String stuff :)
4 years, 2 months ago (2016-10-18 19:29:28 UTC) #10
haraken
https://codereview.chromium.org/2428093002/diff/20001/third_party/WebKit/Source/platform/weborigin/KURL.cpp File third_party/WebKit/Source/platform/weborigin/KURL.cpp (right): https://codereview.chromium.org/2428093002/diff/20001/third_party/WebKit/Source/platform/weborigin/KURL.cpp#newcode764 third_party/WebKit/Source/platform/weborigin/KURL.cpp:764: // Note: because we are canonicalization into narrow characters, ...
4 years, 2 months ago (2016-10-18 19:30:37 UTC) #11
Charlie Harrison
Thanks! BTW I did an updated benchmark using: for (i < 100) { var img ...
4 years, 2 months ago (2016-10-18 19:56:19 UTC) #12
Charlie Harrison
bot failures look real, I'm looking into it.
4 years, 2 months ago (2016-10-18 20:51:08 UTC) #13
Charlie Harrison
Ok tests are fixed, but the failures brought about how this change is a bit ...
4 years, 2 months ago (2016-10-19 12:18:58 UTC) #18
esprehn
https://codereview.chromium.org/2428093002/diff/40001/third_party/WebKit/Source/platform/weborigin/KURL.cpp File third_party/WebKit/Source/platform/weborigin/KURL.cpp (left): https://codereview.chromium.org/2428093002/diff/40001/third_party/WebKit/Source/platform/weborigin/KURL.cpp#oldcode724 third_party/WebKit/Source/platform/weborigin/KURL.cpp:724: init(base, relative.characters16(), relative.length(), queryEncoding); We go down this path ...
4 years, 1 month ago (2016-10-25 22:23:50 UTC) #22
Charlie Harrison
Thanks a lot for the review. I've updated the CL to reflect an offline conversion: ...
4 years, 1 month ago (2016-10-27 02:12:36 UTC) #30
Charlie Harrison
esprehn, friendly ping?
4 years, 1 month ago (2016-11-04 20:37:16 UTC) #32
esprehn
The CheckedNumeric looks weird, I think you want clampTo? otherwise lgtm https://codereview.chromium.org/2428093002/diff/140001/third_party/WebKit/Source/platform/weborigin/KURL.cpp File third_party/WebKit/Source/platform/weborigin/KURL.cpp (right): ...
4 years, 1 month ago (2016-11-04 22:55:59 UTC) #33
Charlie Harrison
thanks!! clampTo makes this code way nicer. https://codereview.chromium.org/2428093002/diff/140001/third_party/WebKit/Source/platform/weborigin/KURL.cpp File third_party/WebKit/Source/platform/weborigin/KURL.cpp (right): https://codereview.chromium.org/2428093002/diff/140001/third_party/WebKit/Source/platform/weborigin/KURL.cpp#newcode742 third_party/WebKit/Source/platform/weborigin/KURL.cpp:742: CheckedNumeric<int> relativeLength( ...
4 years, 1 month ago (2016-11-05 02:23:13 UTC) #36
esprehn
yay, still lgtm https://codereview.chromium.org/2428093002/diff/180001/third_party/WebKit/Source/platform/weborigin/KURL.cpp File third_party/WebKit/Source/platform/weborigin/KURL.cpp (right): https://codereview.chromium.org/2428093002/diff/180001/third_party/WebKit/Source/platform/weborigin/KURL.cpp#newcode765 third_party/WebKit/Source/platform/weborigin/KURL.cpp:765: m_string = relative; btw why does ...
4 years, 1 month ago (2016-11-05 02:33:14 UTC) #39
Charlie Harrison
https://codereview.chromium.org/2428093002/diff/180001/third_party/WebKit/Source/platform/weborigin/KURL.cpp File third_party/WebKit/Source/platform/weborigin/KURL.cpp (right): https://codereview.chromium.org/2428093002/diff/180001/third_party/WebKit/Source/platform/weborigin/KURL.cpp#newcode765 third_party/WebKit/Source/platform/weborigin/KURL.cpp:765: m_string = relative; On 2016/11/05 02:33:14, esprehn wrote: > ...
4 years, 1 month ago (2016-11-05 03:20:16 UTC) #40
esprehn
On 2016/11/05 at 03:20:16, csharrison wrote: > https://codereview.chromium.org/2428093002/diff/180001/third_party/WebKit/Source/platform/weborigin/KURL.cpp > File third_party/WebKit/Source/platform/weborigin/KURL.cpp (right): > > https://codereview.chromium.org/2428093002/diff/180001/third_party/WebKit/Source/platform/weborigin/KURL.cpp#newcode765 ...
4 years, 1 month ago (2016-11-05 03:22:49 UTC) #41
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/2428093002/180001
4 years, 1 month ago (2016-11-05 14:45:25 UTC) #45
commit-bot: I haz the power
Committed patchset #10 (id:180001)
4 years, 1 month ago (2016-11-05 14:48:30 UTC) #47
commit-bot: I haz the power
4 years, 1 month ago (2016-11-05 14:50:21 UTC) #49
Message was sent while issue was closed.
Patchset 10 (id:??) landed as
https://crrev.com/495bfff108b8c1b2f67bfbd0a7fffceb436b31f8
Cr-Commit-Position: refs/heads/master@{#430166}

Powered by Google App Engine
This is Rietveld 408576698