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

noisecrime noise at noisecrime.com
Wed Sep 21 07:59:32 EDT 2011

Thx for the replies.

@ Ivo Smits 
Initially I did think of Nan or Infinity, but then wouldn't these give a
runtime exception?
I couldn't find any trace when stepping through a debugger, though I didn't
check all 16000 entries in the array. I've since tried testing directly for
Nan (float.IsNaN) but nothing was found.

@ Rodrigo Kumpera
Denormals, that sounds much more likely, especially as the values I got from
the debugger were towards 1e-44. That would explain the performance drop.
Trouble is I've since tried checking for these and simply zero-ing them
(e.g. if(Math.Abs( x[i] ) < 1e-38 ) x[i] = 0;), but that appeared to have no
effect? Indeed I found it was zero-ing values when the performance was
running fine, so clearly the fluid sim is generating some very small values

However its the best explanation i've heard, it makes a lot of sense in the
context of the code.

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

More information about the Mono-devel-list mailing list