9 Feb
2007
9 Feb
'07
7:36 p.m.
On Feb 9, 2007, at 10:52 AM, Sebastian Weber wrote:
Anyway, even it is off-topic, I'm wondering weather a
put(someMap, key, get(someMap, key) + 1)
is much slower than doing it directly (I know that map is a vector and key is a std::size_t-index) via
++someMap[key];
Or is the compiler so smart to make the first expression equal to the last one? Since I'm doing lots of stuff like this (and I don't care to much about generality, but rather raw performance), this would be very important to know. For sure I will try it out, but I'm anyway interested in your opinion, concering that point.
Without measuring it, I can't tell you for certain. With a decent inliner, there should be no difference in the performance. Cheers, Doug