Monday, February 23, 2009

Code Optimization Tips

* if you've got a lot of if / else statements try to put the one most likely to be met first

* use a++ and a-- instead of a+=1 and a-=1

* even better, use ++a or --a instead of their post-increment versions. For primitive types, on some architectures, this will make a difference. For STL iterators, it's much more important and may save a lot of overhead.
Author : Basker Swaminathan

0 nhận xét:

Post a Comment