[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
Wed Mar 16 13:59:29 PDT 2016
dexonsmith updated this revision to Diff 50869.
dexonsmith added a comment.
Eric and I had a quick chat on IRC.
- The asymmetric usage of __extract_key and __can_extract_key was awkward, as Eric pointed out already.
- However, a symmetric __extract_key would have caused Clang (and other compilers) to IRGen extra copies of operator().
- Eric suggested using a custom tag type (instead of true_type/false_type) to avoid the problem entirely.
I implemented that in this updated patch, and it's way cleaner. I'm using:
- __extract_key_fail_tag: cannot extract key.
- __extract_key_self_tag: use the argument itself as the key.
- __extract_key_first_tag: use ".first" on the argument to grab the key.
http://reviews.llvm.org/D16360
Files:
include/__hash_table
test/libcxx/containers/unord/unord.map/insert_dup_alloc.pass.cpp
test/libcxx/containers/unord/unord.set/insert_dup_alloc.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16360.50869.patch
Type: text/x-patch
Size: 7496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160316/66d3cb17/attachment-0001.bin>
More information about the cfe-commits
mailing list