Unexpected performance results


D

Dave

Hello all,

Can anybody think of a plausible explanation for why my profiler is telling
me that I get better performance with map::eek:perator[] than with
map::insert()?

Thanks,
Dave
 
Ad

Advertisements

L

Leor Zolman

Hello all,

Can anybody think of a plausible explanation for why my profiler is telling
me that I get better performance with map::eek:perator[] than with
map::insert()?

This would be totally a QOI issue, but I did take a look just for grins in
an implementation or two, and I noticed that, even though operator[] tends
to call insert() to do its work, insert() returns a pair<...> by value
while operator[] just returns a ref to an element. Perhaps the construction
of that return value from insert() might be your culprit...
-leor
 

Top