Closed
Bug 934048
Opened 11 years ago
Closed 7 years ago
web-worker slower for asm code
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: mbirukou, Unassigned)
Details
(Whiteboard: [bugday-20131106])
Attachments
(1 file)
147.73 KB,
application/gzip
|
Details |
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0 (Beta/Release) Build ID: 20131028112446 Steps to reproduce: Attached file contains html, which uses scripts with both js, and asm code, generated by emscripten. Both do encryption routines. Runs in web-worker just recently were substatially slower than those in UI event loop for both js and asm. But with current v25 (on Ubuntu x64) js code runs just percents slower in web worker, while asm code is three times slower. This is not the case in Google Chrome, so I file this bug. Also note that there was a similar report, but for simple js test code, and that run fine for me, while both js and asm were slower in web-worker.
Actually, even js code is slower. Its just that 623 in web-worker vs 280 milliseconds in UI loop for 1MB encryption (on 3GHz system). So, both js and asm in contained file run slower in a web worker.
I should detail, that ecma-nacl code is what I referred to as just js, while js-nacl is emscripten-produced asm.js
Updated•11 years ago
|
Component: Untriaged → DOM: Workers
Product: Firefox → Core
Whiteboard: [bugday-20131106]
I don't know if this is really a worker thing... Maybe some JIT flag we're not setting? Tentatively moving to JS so that the more knowledgeable folks can weigh in or investigate.
Component: DOM: Workers → JavaScript Engine
Comment 4•11 years ago
|
||
The attached code does not validate as asm.js. For one thing, it doesn't include "use asm" anywhere that I can see. asm.js generation is the default in Emscripten nowadays; perhaps you could try rebuilding with a recent pull of Emscripten? This means that both the "asm.js" and "normals JS" are using the normal Ion JIT heuristics. Why is the asm.js slower in workers? I suspect it is due to bug 927516: since we don't use background compilation in workers, we use a lower threshold for scripts that are judged too big to compile. If there are some big functions in the asm.js, they may be getting stuck in our slower baseline JIT. If you generate validating asm.js, then all these heuristics are bypassed and you should see the same perf in workers as on the main thread. To confirm you have validating asm.js, look for a success/failure warning in the JS console. E.g., see http://kripken.github.com/ammo.js/examples/new/ammo.html for asm.js in a worker.
Comment 5•11 years ago
|
||
The code looks like it was optimized with closure compiler. Closure compiler is unaware of asm.js, so its output is not going to be valid asm.js. Emscripten will not run closure on asm.js output for that reason. How did you generate this code? (What emcc command, what other stuff - did you run closure manually?)
Comment 6•11 years ago
|
||
Note: Emscripten has its own minifier that does respect "use asm" and is much much faster than Closure.
But even regular code (ecma-nacl) gets slower, take a look at numbers in the test. May be the Emscripten thingy is not relevant here.
Comment 8•11 years ago
|
||
(In reply to mbirukou from comment #7) Yes, that is in line with what I was saying in comment 4: non-asm.js-validating code may run slower in workers because of bug bug 927516.
Updated•7 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Flags: needinfo?(mbirukou)
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•