Re: Float denormal issue in JavaScript processor node in Web Audio API (3)

Le 23 juin 2014 à 05:17, Katelyn Gadd <> a écrit :

> You should be clearer about your repro steps, it took me a while to
> figure out what you meant. As far as I can tell you mean:
> Mash on the 'gate' button to play lots of notes at once (presumably
> this spins up multiple channels). Once the notes all stop playing the
> channels are now 'idle' and for some reason this maxes out the CPU
> (presumably trying to mix/synth all of them). In FF nightly all the
> CPU time is being spent somewhere inside your asm.js AOT compile (for
> some reason Firefox's sampling profiler does not track line number
> information for AOT compiles... I should file a bug about this.) It is
> interesting that the CPU usage steadily climbs over time in both FF
> and Chrome. Are you sure that this is just due to denormals?

We are almost sure of that: we can reproduce the same behavior (CPU raise after the notes have been payed and become idle for some seconds…) in the pure C++ version when compiled without this AVOIDDENORMALS macro and run using JACK (, which start it's own real-time thread on OSX to run audio code. If AVOIDDENORMALS is added, the problem disappear.

> The fact that your demo is heavily minified and optimized makes it
> hard to tell what is actually going on in the code. It would be cool
> if your demonstration contained less code so it would be possible to
> look at the hydrogen IR (for v8) or the bytecode+generated jitcode (in
> spidermonkey).

Here is a "debug" version compiled with emcc -profiling and -s LINKABLE=1 so that  lines can be looked at:

The real audio computation happens in "__ZN5piano7computeEiPPfS1_"

> Those are usually my first steps when trying to
> understand exactly what's going wrong with JS perf, but I can't easily
> do either of those things on this demo.

Stéphane Letz

Received on Monday, 23 June 2014 06:25:18 UTC