Q:

Performance of std::pow - cache misses?

I've been trying to optimize a numeric program of mine, and have run into something of a mystery.  I'm looping over code that performs thousands of floating point operations of which 1 call to pow - nevertheless, that call takes 5% of the time...  That's not necessarily a critical issue, but it is odd, so I'd like to understand what's happening.
When I profiled for cache misses, VS.NET 2010RC's profiler reports that virtually all cache misses are occurring in std::pow... so... what's up with that?  Is there a faster alternative?  I tried powf, but that's only slightly faster; it's still responsible for an abnormal number of cache misses.
Why would a basic function like pow cause cache-misses?
Edit: this is not managed code.  /Oi intrinsics are enabled, but the compiler may at its option ignore that.  Replacing pow(x,y) by exp(y*log(x)) has similar performance - just now all the cache misses are in the log function.

A:

If you replace std::pow(var) with another function, like std::max(var, var), does it still take up 5%?  Do you still get all the cache misses?
I'm guessing no on time and yes on cache misses.  Calculating powers is slower than many other operations (which are you using?).  Calling out to code that's not in the cache will cause a cache miss no matter which function it is.

