2012-01-27

Speed of iterator of STL

Some cases of STL, especially iterator, show low speed.

Therefore, if you want to speed up, some codes for iterator should be changed.

/* First */
for(vector::iterator itr = vector.begin(); itr != vector.end(); itr++){ // low
/* TODO */
} // for

int vector_size = vector.size();
for(int i = 0; i < vector_size; i++){ // high
/* TODO */
} // for


/* Second */
function low(vector p_a){
}

function high(vector & p_a){
}

No comments:

Post a Comment