Qbasicnews.com

Full Version: Sin/Cos function overhead
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Just a curiousity about certain functions, such as logirithms and cosine, where you already have CPU instructions for this stuff that push values to the stack. Is FB optimized such that it doesn't call a function for certain special operations (sin, cos, log, etc), but rather treats it like another operator? I imagine this would be of interest in particular to people wanting to make 3d games... I'm just asking out of curiousity, as I don't have FB here to find out myself.
I would assume that even if it was optimized...creating internal sin/cos/tan if needed arrays of calculated values would still be quicker :-)...
Probbly. *shrug* It's also good for heavy calcuation functions such as logaritms.
Yes, CVS version already has this kind of optimization: SIN, ASIN, COS, ACOS, TAN, ATN, SQR, LOG, INT and ATAN2 are all implemented as direct asm instructions.
About lookup tables, I'm not so sure anymore they're really worth the trouble on modern hardware...
Has anyone tested to see how much faster the CVS version is?
yes V1ctor himself did once the optimized routines were done...now it rivals c's performances easily.
Wow... I never thought it would go this far. I mean I hoped it would, but... well, you know. Wink
lol yeah I do...:-).

but yeah it was well worth the effort in optimizing them :-).
Wow. So all I have to do is mention a feature and it's already in the CVS? Uuuuuum, objects. No! wait! MacOs support! Oh, wow, this is fun, adding features! Smile See, I'm helping!
The testing version has anything but POW inline: http://www.freebasic.net/downloads.php#6.

M$ VC 6 transcendental functions were really slow, and they used Look Up Tables when possible. Probably good enough on old boxes, but not on Athlon's, PIII's or above.
Pages: 1 2