Fastest implementation of sine, cosine and square root in C++ (doesn't
need to be much accurate)
I am googling the question for past hour, but there are only points to
Taylor Series or some sample code that is either too slow or does not
compile at all. Well, most answer I've found over Google is "Google it,
it's already asked", but sadly it's not...
I am profiling my game on low-end Pentium 4 and found out that ~85% of
execution time is wasted on calculating sinus, cosinus and square root
(from standard C++ library in Visual Studio), and this seems to be heavily
CPU dependent (on my I7 the same functions got only 5% of execution time,
and the game is waaaaaaaaaay faster), . I cannot optimize this three
functions out, nor calculate both sine and cosine in one pass (there
interdependent), but I don't need too accurate results for my simulation,
so I can live with faster approximation.
So, the question: What are the fastest way to calculate sine, cosine and
square root for float in C++?
No comments:
Post a Comment