A js source compressor is 2.5x faster in Chrome compared to Nightly (and we spend a lot of time in Baseline)
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox119 | --- | fixed |
People
(Reporter: mayankleoboy1, Assigned: jandem)
References
(Blocks 1 open bug, )
Details
Attachments
(5 files)
Go to https://codegolf.github.io/zpng/
Set the number of iterations to 1
Copy and paste the sample .js file in the input box
Press "Compile" button
Nightly: https://share.firefox.dev/3QXkgU5 (86 seconds)
Chrome: https://share.firefox.dev/45KSCxF (34 seconds)
ER: Maybe faster.
Reporter | ||
Comment 1•1 year ago
|
||
Updated•1 year ago
|
Assignee | ||
Comment 2•1 year ago
|
||
That ke
function is pretty large but mostly runs in Baseline. Its size might have something to do with that, although there are some Ion samples of it so we probably do end up compiling it if the profile is correct.
NI myself to see if there's something weird going on with this function.
Assignee | ||
Comment 3•1 year ago
|
||
This is a really good find, thanks for reporting this! It's a bailout issue caused by the type policy for MBooleanToInt32
.
I have a fix, but I'm still looking into adding some assertions to the type policy code to catch similar issues.
I also have a shell version of this website that I'll attach to this bug. The fix improves that from ~85 seconds to ~16 seconds, almost exactly the same as what I get with an old V8 shell build.
Assignee | ||
Comment 4•1 year ago
|
||
Assignee | ||
Comment 5•1 year ago
|
||
We were relying on MBooleanToInt32
's type policy to insert a fallible unbox
for the to-boolean conversion. This caused a performance cliff because for
frequent TypePolicy
bailouts we disable compilation instead of invalidating
the script.
The fix is to add the unbox instruction in the transpiler.
Assignee | ||
Comment 6•1 year ago
|
||
This fixes issues caught by the assertion added in the next patch. These operations
are actually infallible so didn't have the same performance cliff.
Depends on D187264
Assignee | ||
Comment 7•1 year ago
|
||
This would catch similar issues in the future and is a nice invariant to maintain.
Depends on D187265
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Comment 9•1 year ago
|
||
bugherder |
Assignee | ||
Comment 10•1 year ago
|
||
Mayank, can you confirm this is fixed in the latest Nightly?
Comment 11•1 year ago
|
||
Reporter | ||
Comment 12•1 year ago
|
||
(In reply to Jan de Mooij [:jandem] from comment #10)
Mayank, can you confirm this is fixed in the latest Nightly?
Profile with latest nightly : https://share.firefox.dev/3EmVd5k (https://hg.mozilla.org/mozilla-central/rev/738c0a460acb30ab2ab419f4c0dc93fa9af200d6)
This shows no improvement for some strange reason. However, earlier today I had downloaded a opt build built from the link in comment #8, and that had showed 16 seconds. Not sure whats the reason why Nightly doesnt show the perf improvement.
I will retest in a couple of days when i have my regular laptop charger.
Assignee | ||
Comment 13•1 year ago
|
||
(In reply to Mayank Bansal from comment #12)
Profile with latest nightly : https://share.firefox.dev/3EmVd5k (https://hg.mozilla.org/mozilla-central/rev/738c0a460acb30ab2ab419f4c0dc93fa9af200d6)
This shows no improvement for some strange reason. However, earlier today I had downloaded a opt build built from the link in comment #8, and that had showed 16 seconds. Not sure whats the reason why Nightly doesnt show the perf improvement.I will retest in a couple of days when i have my regular laptop charger.
Mysterious. I just tested this locally with the latest Nightly and I got about 24 seconds. Your latest profile also shows that the ke
function now spends almost all of its time in Ion.
Feel free to file a new bug if you're still seeing issues here.
Reporter | ||
Updated•1 year ago
|
Comment 14•1 year ago
|
||
Backed out or causing assertion failures on TypePolicy.cpp
Reporter | ||
Comment 15•1 year ago
|
||
(In reply to Mayank Bansal from comment #12)
(In reply to Jan de Mooij [:jandem] from comment #10)
Mayank, can you confirm this is fixed in the latest Nightly?
Profile with latest nightly : https://share.firefox.dev/3EmVd5k (https://hg.mozilla.org/mozilla-central/rev/738c0a460acb30ab2ab419f4c0dc93fa9af200d6)
This shows no improvement for some strange reason. However, earlier today I had downloaded a opt build built from the link in comment #8, and that had showed 16 seconds. Not sure whats the reason why Nightly doesnt show the perf improvement.I will retest in a couple of days when i have my regular laptop charger.
I have no idea what I was thinking when I wrote this comment :| . I have some jetlag...
The profile in this comment is 32.9 seconds long. . So we are already faster than Chrome which took 34 seconds on my machine.
This bug improved the original testcase from 84 seconds -> 33 seconds which is a massive 2.5x improvement.
This bug is quite effectively fixed. Thanks :jandem for the fix!
Assignee | ||
Updated•1 year ago
|
Comment 16•1 year ago
|
||
Comment 17•1 year ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/495c75053248
https://hg.mozilla.org/mozilla-central/rev/7cbe6eba05b9
Description
•