[PATCH] D16360: unordered_map: Avoid unnecessary mallocs when no insert occurs

Duncan P. N. Exon Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 1 18:15:44 PST 2016


Marshall, thanks for the link to #2464.  That does look scary.

Nevertheless, I think this -- and the other over-eager allocations
in {unordered_,}{multi,}{map,set} -- are worth optimizing as long
as we can do it in a standards-compliant way.  It's a pretty serious
regression in performance compared to expectations from C++03's
insert().

Let me know if you can think of some testing I can add to be sure
I'm not breaking anything (maybe test/std/.../ doesn't have enough
coverage?).

> On 2016-Jan-25, at 07:54, Marshall Clow <mclow.lists at gmail.com> wrote:
> 
> mclow.lists added a comment.
> 
> I don't have any comments on this code at this time, but I want to caution people that this part of the standard library is **extremely** carefully specified, and meeting all the requirements is a fiddly bit of work.
> 
> For an example of this, look at LWG issue #2464, which has been added to the draft C++17 standard.
> 
> 
> http://reviews.llvm.org/D16360


More information about the cfe-commits mailing list