[Mono-dev] Weird performance problems possibly due to floats and precision issues?

noisecrime noise at noisecrime.com
Wed Sep 21 09:00:44 EDT 2011

Good news, looks like I may have found a solution to the problem.

Though I probably need to do some further testing, it does indeed appear to
be denormals causing the issue. After reading up on it online its been a
very common problem for DSP/audio developers and thankfully there appears to
be a simple solution.

This page describes the problem and various solutions 

I went with the simplest
“On every location in the code where denormalization might occur, just add
1.0e-24 to the float value, then subtract it again, that should fix it.”

Doing that in just the lin_solve function such as

x[i+N2J] =  denormal + (( x0[i+N2J] + a * (x[i-1+N2J] + x[i+1+N2J] +
x[i+N2JN] + x[i+N2JP]) ) * oneOverC);
x[i+N2J] -=  denormal;

gives constant performance, though I suspect i'll need to add it to a few
other places in the code as well.

View this message in context: http://mono.1490590.n4.nabble.com/Weird-performance-problems-possibly-due-to-floats-and-precision-issues-tp3829087p3829895.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

More information about the Mono-devel-list mailing list