Difference between revisions of "Profiling"
From OTBWiki
m (Reverted edits by Ulofyvy (Talk); changed back to last version by Manuel.grizonnet) |
|||
Line 1: | Line 1: | ||
This page compiles some profiling conclusions and tips: | This page compiles some profiling conclusions and tips: | ||
− | + | ===Method GetSize()=== | |
*Avoid: | *Avoid: | ||
− | ''for (int i=0;i | + | ''for (int i=0;i<v.GetSize();++i) {}'' |
*Prefer: | *Prefer: | ||
''const unsigned int size = v.GetSize(); | ''const unsigned int size = v.GetSize(); | ||
− | for (int i=0;i | + | for (int i=0;i<size;++i) {}'' |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
Revision as of 18:27, 19 November 2010
This page compiles some profiling conclusions and tips:
Method GetSize()
- Avoid:
for (int i=0;i<v.GetSize();++i) {}
- Prefer:
const unsigned int size = v.GetSize(); for (int i=0;i<size;++i) {}