Nightly is 2x slower on a simplistic Matrix multiplier
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
People
(Reporter: mayankleoboy1, Unassigned)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
Attachments
(2 files)
Open attached testcases V1 and V2
Enter 1000
Press enter
V1
Nightly: https://share.firefox.dev/3WDZnzt (10s)
Chrome: https://share.firefox.dev/3EqUymy (4s)
V2
Nightly:https://share.firefox.dev/3Egkkdn (1.9s)
Chrome:https://share.firefox.dev/4hyTJXi (1.2s)
Testcase is generated by Chatpgpt. V2 is what it created when i asked it to "make the V1 testcase run 100x faster".
- No idea how important of an optimization target pure matrix multiplication is now.
- Maybe if you encounter pattern like V1, transform it internally into V2 so that the speed becomes 5x
Reporter | ||
Comment 1•17 days ago
|
||
Comment 2•12 days ago
|
||
In general, it's extremely difficult and fragile for us to do transformations like this in the compiler, because we aren't allowed to change the observable behaviour of the program. In this case, if either input is a Proxy, or has getter elements, then changing the order of the element accesses would change the order in which the proxy traps / getters are invoked.
In general, I would hope that anybody doing performance-sensitive matrix multiplication in the browser these days is using Wasm. We do know that we're behind on number-crunchy array stuff in JS, but that kind of code is already somewhat over-represented in benchmarks (especially Jetstream). If we were going to dig into this kind of code, we have existing benchmarks. (This one from sp3 is probably our highest priority.)
I think we're unlikely to spend a lot of time working on this testcase in particular, but if we make changes targeting this kind of codegen, it might be nice to have a list of other examples to see how well our work generalizes. I've created a metabug for slow number-crunchy JS.
Reporter | ||
Comment 3•11 days ago
•
|
||
With latest Nightly, testcase opened from b.m.o as an attachment:
V1: https://share.firefox.dev/4jI3uUW (7s)
V2: https://share.firefox.dev/4hnIrpb (1.6s)
So we are now faster by 30%. Jan had some initial thought that bug 1944843 may have improved this.
Testcase opened from local machine: https://share.firefox.dev/4jJh76a (8.5s)
So somehow opening the testcase from local machine makes it 20% slower!?!?
Description
•