Closed
Bug 1429245
Opened 6 years ago
Closed 6 years ago
Optimize CommonUtils.bytesAsHex
Categories
(Firefox :: Sync, enhancement, P1)
Firefox
Sync
Tracking
()
RESOLVED
FIXED
Firefox 59
Tracking | Status | |
---|---|---|
firefox59 | --- | fixed |
People
(Reporter: eoger, Assigned: eoger)
Details
Attachments
(1 file)
CommonUtils.bytesAsHex [0] shows up on profiles and could be faster [1] if we changed the algorithm to concatenate the hex values to a string directly instead of using a intermediate array. [0] https://searchfox.org/mozilla-central/rev/03877052c151a8f062eea177f684a2743cd7b1d5/services/common/utils.js#216 [1] https://jsperf.com/bytesashex
Comment 1•6 years ago
|
||
https://jsperf.com/bytes-as-hex/1 has a slightly more optimized version, uses possibly more realistic strings, and makes more of an attempt to avoid the JIT optimizing away the bulk of the work.
Comment hidden (mozreview-request) |
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → eoger
Status: NEW → ASSIGNED
Priority: -- → P1
Comment 3•6 years ago
|
||
mozreview-review |
Comment on attachment 8941628 [details] Bug 1429245 - Optimize CommonUtils.bytesAsHex. https://reviewboard.mozilla.org/r/211868/#review217798 Clearing review as discussed in IRC.
Attachment #8941628 -
Flags: review?(tchiovoloni)
Comment hidden (mozreview-request) |
Comment 5•6 years ago
|
||
mozreview-review |
Comment on attachment 8941628 [details] Bug 1429245 - Optimize CommonUtils.bytesAsHex. https://reviewboard.mozilla.org/r/211868/#review217800 Looks good to me! Can you double-check that we have test coverage for this function already? I'm pretty sure we do.
Attachment #8941628 -
Flags: review?(tchiovoloni) → review+
Pushed by eoger@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d7e62d039551 Optimize CommonUtils.bytesAsHex. r=tcsc
Comment 7•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d7e62d039551
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox59:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 59
Comment 8•6 years ago
|
||
Why bytes[i].charCodeAt(0) and not bytes.charCodeAt(i) ?
Comment 9•6 years ago
|
||
I don't think there's a reason. We'd probably want to check that this is just as fast though (I mean, it seems very unlikely it matters), this function was at the top of most profiles during a sync.
Comment 10•6 years ago
|
||
To be clear, I probably should have caught that during the review :p
You need to log in
before you can comment on or make changes to this bug.
Description
•