Performance of vector::size() : is it as fast as reading a variable?

后端 未结 7 1098
孤城傲影
孤城傲影 2020-12-30 20:38

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 c

相关标签:
7条回答
  • Performance of vector::size() : is it as fast as reading a variable?

    Probably not.

    Does it matter

    Probably not.

    Unless the work you're doing per iteration is tiny (like one or two integer operations) the overhead will be insignificant.

    0 讨论(0)
提交回复
热议问题