[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 17:52:52 PST 2016


dexonsmith updated this revision to Diff 46603.
dexonsmith added a comment.

Eric, I think this addresses all of your review comments.

There are a couple of prep NFC commits that I sent for review:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160201/148661.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160201/148662.html

What's changed here:

- insert() now calls emplace() -- this could be split out (it is locally).
- Renamed __hash_table::__insert_unique_value to __insert_unique_key_value and updated callers -- this could also be split out (it is locally).
- Moved the dispatch logic to emplace().
- Changed the dispatch logic to use a type trait (although it's still multi-stage to find the number of arguments).
- Removed the unnecessary #ifdefs in the hasher (etc.).


http://reviews.llvm.org/D16360

Files:
  include/__hash_table
  include/unordered_map
  test/libcxx/containers/unord/unord.map/insert_dup_alloc.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16360.46603.patch
Type: text/x-patch
Size: 10908 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160202/3caed596/attachment.bin>


More information about the cfe-commits mailing list