|
From: Vale G. <val...@at...> - 2003-08-04 18:25:08
|
Balázs -
> I need to do heavy optimizations in the project I am working on, and I am
asking you, whether will I gain any speedup by optimizing loops.
> for(i=0;i<getint();i++){...}
The only way to know for sure whether and where you need to optimize the code is
to run the profile program on it.
That said, I would suggest changing the increment operator from postfix to
prefix.
for (i=0; i<getint(); ++i)
See:
http://www.tantalon.com/pete/cppopt/asyougo.htm
http://www.devx.com/cplus/Article/16328/0/page/4
It probably doesn't matter much; your compiler may already be optimizing this
code for you.
Charles
|