Re: Caching of math functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/11/2016 01:17 PM, NightStrike wrote:
> Well that was certainly a significant help, and super easy to do.  And
> your assumption that I'd rather trade startup slowness for runtime
> efficiency is 100% correct, so thanks!
> 
> First cycle without LD_BIND_NOW: 18us
> First cycle with LD_BIND_NOW: 12us
> First cycle with those 3 math calls commented out, LD_BIND_NOW on or off: 6us
> Second and subsequent cycles regardless of above settings: 3us
> 
> (So in other words, even in the worst case first cycle, the second and
> subsequent cycles are always 3us)
> 
> Are there any more tricks like that to get some more uniform
> distribution on that first cycle?

Just call the three math functions at startup with a dummy argument.
That way you'll load them into the processor cache (assuming that is
what you need). Beware that you will eventually get different timings
due to context switches and cache flushes from time to time anyway.

Or maybe do a dummy call on your function when starting up the program?
What kind of hardware do you use?

regards, Matthias




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux