Boost logo

Boost Users :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2007-02-09 14:36:28


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net