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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top