I have do an extensive calculation on a big vector of integers. The vector size is not changed during the calculation. The size of the vector is frequently accessed by the code. What is faster in general: using the vector::size()
function or using helper constant vectorSize
storing the size of the vector?
I know that compilers usually able to inline the size()
function when setting the proper compiler flags, however, making a function inline is something that a compiler may do but can not be forced.
↧
Performance of vector::size() : is it as fast as reading a variable?
↧