Closed Bug 1991101 Opened 11 months ago Closed 11 months ago

Slow getter calls after stub folding on postcss-wtb

Categories

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

task

Tracking

()

RESOLVED FIXED
145 Branch
Tracking Status
firefox145 --- fixed

People

(Reporter: jandem, Assigned: iain)

References

(Blocks 2 open bugs)

Details

(Keywords: perf-alert)

Attachments

(1 file)

I noticed slow getter calls from GetPropMaybeCached on postcss-wtb in JetStream 3. What seems to happen is this:

  1. We have a getter call with > 16 receiver shapes but the shapes have a shared proto with the getter property.
  2. We can use stub folding for the first 16 shapes and after that we stop folding and add a few more single-shape IC stubs.
  3. In Warp we see we have multiple Baseline stubs so we use an IonGetPropertyIC.
  4. The IonGetPropertyIC eventually uses MegamorphicLoadSlotPermissiveResult.
  5. Because this is IC code, we don't support calling the getter directly from JIT code and instead always go through C++.

We could support calling the getter from IC code, but then we still have an Ion IC instead of being able to use the transpiler. Maybe we should discard stubs and mark the IC megamorphic when we reach the stub folding limit.

Below is a micro-benchmark that's 2.5x faster with --no-ion or 5-6x faster with TryFoldingStubs disabled.

var objs = [];
var proto = {get getter() { return 1; }};
for (var i = 0; i < 18; i++) {
  var obj = Object.create(proto);
  obj["x" + i] = 1;
  objs.push(obj);
}
function f(objs) {
  var res = 0;
  var t = Date.now();
  for (var i = 0; i < 10_000_000; i++) {
    var o = objs[i % 18];
    res += o.getter;
  }
  print(Date.now() - t);
  return res;
}
f(objs);

Yeah, it seems reasonable to go megamorphic here.

Blocks: sm-jits
Severity: -- → N/A
Priority: -- → P3

This makes the microbenchmark in this comment ~5x faster.

Assignee: nobody → iireland
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 145 Branch

This improved our postcss-wtb score by 10-20% (depending on platform and metric) and closed about half the gap with chrome.

QA Whiteboard: [qa-triage-done-c146/b145]

(In reply to Pulsebot from comment #3)

Pushed by iireland@mozilla.com:
https://github.com/mozilla-firefox/firefox/commit/3622a329e9ed
https://hg.mozilla.org/integration/autoland/rev/7b3df8ade384
Transition to megamorphic when stub folding limit is reached r=jandem

Perfherder has detected a devtools performance change from push 7b3df8ade38494b6847c71a7582bf25afd642d43.

If you have any questions, please reach out to a performance sheriff. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
7% damp custom.netmonitor.manyrequests.togglepanel linux1804-64-shippable-qr e10s fission stylo webrender 482.45 -> 448.66

Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.

If you need the profiling jobs you can trigger them yourself from treeherder job view or ask a performance sheriff to do that for you.

You can run all of these tests on try with ./mach try perf --alert 47092

The following documentation link provides more information about this command.

Keywords: perf-alert

(In reply to Pulsebot from comment #3)

Pushed by iireland@mozilla.com:
https://github.com/mozilla-firefox/firefox/commit/3622a329e9ed
https://hg.mozilla.org/integration/autoland/rev/7b3df8ade384
Transition to megamorphic when stub folding limit is reached r=jandem

Perfherder has detected a browsertime performance change from push 7b3df8ade38494b6847c71a7582bf25afd642d43.

If you have any questions, please reach out to a performance sheriff. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.

Improvements:

Ratio Test Platform Options Absolute values (old vs new) Performance Profiles
3% speedometer3 NewsSite-Nuxt/NavigateToUS/Async linux1804-64-nightlyasrelease-qr fission webrender 41.11 -> 40.04 Before/After

Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.

If you need the profiling jobs you can trigger them yourself from treeherder job view or ask a performance sheriff to do that for you.

You can run all of these tests on try with ./mach try perf --alert 47054

The following documentation link provides more information about this command.

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

Attachment

General

Created:
Updated:
Size: