There isn't a way to change denormal handling in JS. The spec doesn't say
either way, but I believe all browsers allow denormals in practice, which
is why you can see a slowdown.

I'm afraid the only way around this is to modify your code to avoid
denormals, if that's possible.

- Alon



On Thu, Jun 19, 2014 at 5:20 AM, Stéphane Letz <[email protected]> wrote:

> Hi,
>
> We successfully compile our C++ audio processing code with emcripten in
> asm.js to deploy on the web. But our C++ code uses the following
> denormalized float number protection code ("protection" is needed since
> denormalized float number computation is awfully slow and has to be
> avoided):
>
> #ifdef __SSE__
>
>     #include <xmmintrin.h>
>
>     #ifdef __SSE2__
>
>         #define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8040)
>
>     #else
>
>         #define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8000)
>
>     #endif
>
> #else
>
>     #define AVOIDDENORMALS
>
> #endif
>
>
> Basically we add a call at AVOIDDENORMALS before each audio  block
> processing. It seems this AVOIDDENORMALS is just removed by the emcripten
> compiler and so we get asm.js code that seems to produce denormalized
> floats and the speed issue occurs.
>
>
> Is there any solution to keep this assembly code in the produced asm.js
> code, or sole the problem in another way ?
>
>
> Thanks.
>
>
> Stéphane Letz
>
> --
> 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.
>

-- 
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