3 ms·
The speed difference is hardly negligible especially when talking about benchmarks. It's actually about 15% on my OS X laptop, less but still measurable on a Li
by pvg 17y ago
The speed difference is hardly negligible especially when talking about benchmarks. It's actually about 15% on my OS X laptop, less but still measurable on a Linux server. Your change actually has a greater impact on execution time than off-by-ones in the iteration counts which don't really take place.
- jedbrown 17y ago15% is a bit higher than I benchmark, but here is a version that is guaranteed to do the correct number of iterations, increments in floating point instead of performing the slow cast, and is faster than performing the comparison in floating point math (because it occupies a different execution unit). Note that it is also less accurate than the cast for most definitions of what this function might be attempting to measure. http://gist.github.com/288980 http://gist.github.com/288980