I've been running som eprofile tests of a slow area of code. This is with Visual Studio 2008 and .NET 2 (fully patched). About 32% of my computation is used by the Haversine formula. This requires two sines, two cosines, a square root, and an arc sine - all using the standard .NET Math library (ie. Math.Sin, Math.Asin, Math.Sqrt). I've been able to easily cache the cosines - resulting in a roughly 25-30% speedup of the Haversine function.
In the profile I'm seeing __CIasin_pentium4 and __CIasin neither of which find much on Google except for things like stack dumps that people have posted. The pentium4 variant grabs about twice as many samples (both inclusive and exclusive). I'm assuming this is an arc sine, but is it really so much more expensive than a sine? There is no sign of a sine in the profile even though twice as many will be computed.
Are both of these functions arcsines, or is one a sine? If not, what do they represent?
Yes I've seen various articles and posts on the Internet and here about fast sines. I really do need the accuracy of a computed sine rather than a look up table or truncated Taylor series. I'm using the Haversine to compute and/or compare distances on the Earth's surface. 10m accuracy (the minimum IMHO for my app) equates to about 1/640000 radians.
One thought for speed is to multiple out the trigonometric identities. Although this would result in more trig functions, they would become dependent on individual end points only and hence become cacheable. Another is to unwrap the arcsine and the square root for my comparisons. I think the latter has a lot of scope for improvement, however at the moment I am trying to understand what is taking the processing time and exactly what the __CIasin functions represent.