Open Bug 1732605 Opened 3 years ago Updated 2 years ago

Demo at https://codepen.io/DonKarlssonSan/pen/yLXEmob is slower in Nightly compared to Chrome. All the time is spent in JS

Categories

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

task

Tracking

()

People

(Reporter: mayankleoboy1, Unassigned)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

Go to https://codepen.io/DonKarlssonSan/pen/yLXEmob
Click on the demo

ER: the demo draws/refreshes quickly
AR: It is slow

Chrome is faster here.

Profile: https://share.firefox.dev/3kJ5kIH
The above profile suggests almost all the time is spent in JS.

Took a quick look. We spend most of our time in intersectsWithAnother, which calls intersectsWith in a loop. We don't inline intersectsWith because it is too big (215 ops; our limit is currently 130). If I strip out all the browser-specific code and run the rectangle-creation in the shell, then increasing the inlining limit roughly doubles the speed, because it lets us hoist some bounds-checking code out of the loop. This doesn't seem to have an effect in the browser, though. I think that's because codepen edits loops to add calls to window.CP.shouldStopExecution (which detects infinite loops). The call to shouldStopExecution is opaque to the optimizer and similarly prevents hoisting.

This is interesting, although I don't immediately see an easy fix.

Priority: -- → P3
Attached file Standalone_testcase.html (deleted) —
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: