[Mono-dev] Weird performance problems possibly due to floats and precision issues?
kumpera at gmail.com
Wed Sep 21 06:52:02 EDT 2011
On Wed, Sep 21, 2011 at 7:04 AM, Ivo Smits <Ivo at ufo-net.nl> wrote:
> Op 21-9-2011 8:31, noisecrime schreef:
> > ...
> > Essentially the function has three nested loops, all of which iterate the
> > same number of times every call. The inner loop is a single line of
> > arithmetic instructions akin to x[i] = y[i] + (a * ( y[s] + y[t] + y[u]
> > y[v]) )/c. It normally completes in a few milliseconds, but when passing
> > the troublesome viscosity value it slows down quickly to taking half a
> > second!
> I have seen similar behaviour on MS .Net in an audio processing
> application. The slowdown there was caused by arithmetic operations on a
> non-value (NaN/Infinity/negative infinity). Such an operation will again
> result in a non-value, which might explain why the slowdown propagates.
> You could easily check for these values in your code.
> I don't know exactly why these things cause such a slowdown. Maybe there
> is some (hardware) exception processing getting in the way, but that's
> just guessing. In my case it helped a lot to check the result for these
> 3 non-values, and set it to some valid value instead. It's not a proper
> solution, but in my case helped to keep the application useable even for
> incorrect input values.
NaN and denormals are many times slower than regular numbers.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list