In trying to squeeze out more performance from the project I ported to JS using 
emscripten, I have recently focused on finding calls from asm.js-ed code into 
non-asm.js functions and then asm.js-ify these functions, if possible. Among 
these functions, my code frequently invokes rint and llrint, which currently 
live in library.js as non-asm.js functions and use Math.round internally. That 
is to say, even though Math.round behaves similar to rint, it is different in 
some edge cases, which is why rint calls cannot simply be replaced by 
Math.round.

I tried to asm.js-ify rint and figured that Math.round is actually not part of 
the asm.js "standard library". In order to work around this, I tried using the 
native musl implementation of rint and have emscripten compile it into asm.js. 
While this works in principle, it does not give me the performance improvement 
I was hoping for. Actually, I even see a minor performance degradation (Firefox 
Nightly). This has probably to do with the fact that Math.round is quite 
optimized, whereas asm.js code does not quite reach native performance. In 
other words, the performance degradation of using the compiled native rint 
function from musl negatively outweighs the performance penalty of calling from 
asm.js into the non-asm.js rint function.

Naturally, this makes me wonder why Math.round is not supported by asm.js and 
if there are plans to add it sometime soon.

Soeren

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to