VBGamer |
|||||||||||||||||||||||||||
Trig optimizations Jay Wheeler (1 reply, 0 views) (2000-Jun-30) Hey guys,
I was trying to make a "Math" class that uses lookup tables to optimize the trig functions. My first call is to 'init' like this:
math.init(255) 'initialize a lookup table with 255 entries
At this point, it calculates the sines and cosines for every angle between 0 and 2*pi with 255 "degrees" of accuracy.
But here's my problem: it's somewhat (30%) slower (compiled, etc.) than the built in trig functions! I know this is a common optimization in C++, but has anybody successfully done this with VB?
Note: my lookup function still needs one divide to determine which slot in the array it should be referencing.
|