N
Nawabzada
Hi
At an "Advanced Systems Programming in C" course I attended recently, we
covered some optimization techniques. There were two I haven't been able
to find referenced in any books...
1) In loops, it's better to count down from n to 0 (instead of from 0 to
n), because a test for 0 is more efficient than comparing 2 variables
2) Also, preincrements ++i are usually quicker than postincrements i++.
I guess I have two questions: Are these right? And if so, why isn't there
more code around that uses them?
//n
At an "Advanced Systems Programming in C" course I attended recently, we
covered some optimization techniques. There were two I haven't been able
to find referenced in any books...
1) In loops, it's better to count down from n to 0 (instead of from 0 to
n), because a test for 0 is more efficient than comparing 2 variables
2) Also, preincrements ++i are usually quicker than postincrements i++.
I guess I have two questions: Are these right? And if so, why isn't there
more code around that uses them?
//n