Closed Bug 1784478 Opened 2 years ago Closed 2 years ago

Support loading from rope right-child in MacroAssembler::loadStringChar

Categories

(Core :: JavaScript Engine: JIT, task, P3)

task

Tracking

()

RESOLVED FIXED
105 Branch
Tracking Status
firefox105 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

Details

(Keywords: perf-alert)

Attachments

(1 file)

The equivalent C++ code has an optimization for one-level deep ropes, but the JIT code only supports this for the left child. This difference can cause performance issues, for example the micro-benchmark below improves from 195 ms to 34 ms with a patch for this.

function f(s) {
    var s1 = "123456789" + s;
    var res;
    for (var i = 0; i < 10_000_000; i++) {
        res = s1.charCodeAt(11 + (i % 8));
    }
    return res;
}
var t = new Date;
f("foobarbaz1234567890");
print(new Date - t);

If you don't already have written a patch, bug 1382639 has a patch, but probably needs to be rebased.

(In reply to André Bargull [:anba] from comment #1)

If you don't already have written a patch, bug 1382639 has a patch, but probably needs to be rebased.

Yeah I wrote the patch earlier today. I didn't know we had this on file already :)

I just compared it against the patch from bug 1382639, but bug 1382639 was before Spectre, so it was quite outdated. :-)

Pushed by jdemooij@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dc047eb790a0
Support loading from rope right-child in MacroAssembler::loadStringChar. r=anba
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 105 Branch

(In reply to Pulsebot from comment #6)

Pushed by jdemooij@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dc047eb790a0
Support loading from rope right-child in MacroAssembler::loadStringChar.
r=anba

== Change summary for alert #35212 (as of Thu, 25 Aug 2022 13:01:15 GMT) ==

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
2% cnn loadtime macosx1015-64-shippable-qr bytecode-cached cold fission webrender 1,074.62 -> 1,052.29
2% cnn loadtime macosx1015-64-shippable-qr bytecode-cached fission warm webrender 626.83 -> 614.17

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=35212

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: