Advertisement

Optimizing...

Started by March 15, 2003 08:18 PM
6 comments, last by DemiGod25 21 years, 8 months ago
What would be quicker, reading in from an already opened file twice, or two bool checks and one addition?
Does it matter? Both of those things take next to no time...

If I had my way, I''d have all of you shot! codeka.com - Just click it.

Advertisement
Just wondering if there is any time difference between the two. Right now what I am doing does one of those 101 times.
2 bool checks and one add in any case i can think of. If it''s a seqential read, and it is cached, it is still more than likely slower than doing 2 cmps and an add (due to the function call over-head, and everything else). It would be better to use the 2 bools and an add if you can . Also, it depends on how much you are reading in, and if you have to seek in this file, etc. A read takes a lot more than 2 cmps and an add though, just calling a kernel function like that takes more time than the cmp''s + add, plus the time to check if it''s cached, if not, then it has to get to the proper location on the hard drive, read it in, and return the value, which is pretty slow considering the speed of a modern cpu.
Thanks, I may not see a noticable difference... but I am obsessed with optimizing right now.
Just remember.. optomize the most heavily called code...

If you optomize the crap out of a loading function that only gets called once, it''s a waste of time. But, if you optomize the main rendering loop, or you optomize the method you are using to do something, it can have substantial gains from small changes. Just make sure you''re optomizing the correct things first .
Advertisement
Well, since I have no time limit, I am optimizing whatever I can. Guess that is the luxury of doing something for fun.
I am also doing stuff for fun, but wasting time optomizing useless stuff is still wasting time . No point in optomizing an inefficient algorythm to death, if you could replace it with a more efficient one that will run faster non-optomized . I have been found guilty of this on more than one occasion, take my terrain engine for example: I optomized my drawing routine to the max, then i implemented triangle strips with vertex and index buffers, and gained a 100%-200% increase in speed on average, so all that time wasted optomizing an inefficient algorythm is just that... time wasted .

This topic is closed to new replies.

Advertisement