Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


quick math

This topic is 5994 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Can somebody give me an idea as to how someone, like me, a newbie, might go about making certain math functions faster -- just an idea of how to do this. At first I was thinking using Assembly, but I wonderred if I was missing something. How quick can assembly really make certain math functions anyway? Thanks for your help, L-

Share this post

Link to post
Share on other sites
what are the math function you are trying to optimize? the functions in Math.h are already about as optimized as they are likely to get.

are you just looking to optimize your game code? if so, the bottle-necks are not likely to be math functions. game bottlenecks are usually in the way you draw polygons, are you using BSP trees to cut down on the number of objects sent to the card for render? are you doing as much drawing as possible with z-buffering turned off?

a good optimization is to minimize the number of divides that you do. if you have code like this:

poo = variable / x;
log = another / x;
dongle = yourmom / x;

it's better to do:

oneOverX = 1/x;

poo = variable * oneOverX;
log = another * oneOverX;
dongle = yourmom * oneOverX;

a good compiler should already optimize the math fctns for you, i doubt you'll gain much by going to assembler to fix things. the bigger gains will be got by restructuring your code.


[edited by - Palidine on July 15, 2002 2:40:44 PM]

Share this post

Link to post
Share on other sites

Assembler is the quickest. It''s kind of a tough language to master, though.

What kind of mathematics are you trying to improve the speed upon?

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!