Closed
Bug 1404385
Opened 7 years ago
Closed 7 years ago
atob() whitespace processing is slow even when not needed
Categories
(Core :: DOM: Core & HTML, defect, P2)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla58
Tracking | Status | |
---|---|---|
firefox58 | --- | fixed |
People
(Reporter: agashlin, Assigned: agashlin)
Details
Attachments
(2 files, 1 obsolete file)
340 bytes,
text/html
|
Details | |
3.29 KB,
patch
|
agashlin
:
review+
|
Details | Diff | Splinter Review |
The whitespace removal code from bug 711180 always copies the input to a new string, even if there is no whitespace to remove. The attached microbenchmark shows converting 100MB takes over 2 seconds in current Nightly (58.0a1 (2017-09-29)) but around 700ms in current Chrome Canary (63.0.3225.0). This shows up in profiles of screenshots, for instance https://perfht.ml/2fDVOId . I have a patch for this which simply doesn't make the copy unless needed.
Assignee | ||
Comment 1•7 years ago
|
||
Assignee: nobody → agashlin
Status: NEW → ASSIGNED
Updated•7 years ago
|
Priority: -- → P2
Assignee | ||
Comment 2•7 years ago
|
||
Comment on attachment 8913803 [details] [diff] [review] Don't copy if not needed for whitespace removal Seems OK on Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=e6f223f0aee8642150288bbda5542a04a4b076af
Attachment #8913803 -
Flags: review?(bugs)
Comment 3•7 years ago
|
||
Comment on attachment 8913803 [details] [diff] [review] Don't copy if not needed for whitespace removal >+ trimmedString.Append(aAsciiBase64String.BeginReading(), cur - start); Why not pass start as the first param? It is after all const char16_t* start = aAsciiBase64String.BeginReading(); Please ensure there are testcases for this: whitespace at the beginning, somewhere in the middle and at the end. And also a case when there is only whitespace and no whitespace at all.
Attachment #8913803 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 4•7 years ago
|
||
New patch with the change recommended in comment 3 and a new test, carrying forward r+ as the code didn't change meaningfully. Some of these test cases were already covered by testing/web-platform/tests/html/webappapis/atob/base64.html but I wanted to be sure I covered all reasonable cases.
Attachment #8913803 -
Attachment is obsolete: true
Attachment #8918481 -
Flags: review+
Assignee | ||
Updated•7 years ago
|
Keywords: checkin-needed
Pushed by ryanvm@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/0efa71a9a60a Don't copy if not needed for whitespace removal. r=smaug
Keywords: checkin-needed
Comment 6•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/0efa71a9a60a
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox58:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•