Open Bug 1868285 Opened 6 months ago Updated 6 months ago

Nightly is slower than Chrome on a Codepen demo (https://codepen.io/ccprog/pen/rNPoNxP?editors=0010)

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

People

(Reporter: mayankleoboy1, Unassigned)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

Go to https://codepen.io/ccprog/pen/rNPoNxP?editors=0010
In the JS part, change the following :

Original : const maxC = 15;
Change: const maxC = 150;

Run the demo
Chrome: https://share.firefox.dev/46JFnNR
Nightly: https://share.firefox.dev/3sUmn1v

In general, Nightly is 2x or more slower.

Seems like we're spending a lot of time in the self-hosted function Array.prototype.find; we probably can improve things here, but this is probably not going to be something we look at soon.

Severity: -- → N/A
Priority: -- → P3

Specifically, it looks like this is the hot find:

    const [c, p] = chooseFrom(current.neighbours.filter(([c]) => c));
    current = cells.find(({c: cc, p: pp}) => c == cc && p == pp);

We have marked ArrayFind as getting special priority for inlining, so I would expect us to inline ArrayFind, inline the lambda, and have good code here. Not sure why that isn't happening. The lambda is not too big to inline.

Ah, running it locally I see:

[WarpTrialInlining] Trial inlining for outer script 'randomWalk' (/home/iain/src/perf2.js:162:21 (3947b4d65790)) (inliningRoot=7f4eff6562b0)
...
[WarpTrialInlining] Inlining candidate JSOp::Call (offset=564): callee script 'find' (self-hosted:349:19)
[WarpTrialInlining] SKIP: had OSR

We don't inline find because we previously did OSR in that function and we don't want to get stuck in baseline. I think it would be reasonable to relax that constraint for the self-hosted array methods that are already getting special treatment. We want to inline these pretty aggressively.

Testing that out locally, though, it looks like we still don't inline. I think it may be because there are multiple calls in this function that we want to trial-inline, but we don't spend enough time in any of them to trigger recursive inlining?

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

Attachment

General

Creator:
Created:
Updated:
Size: