[v3] Fix management of non empty hash functor
François Dumont
frs.dumont@gmail.com
Thu Dec 13 21:33:00 GMT 2012
Hi
As part of a performance patch proposed in an other mailing thread
was a patch to improve management of hash functor with state. This part
is I think less sensible than the performance patch so I propose it
independently. I only would like to commit the modification on the
performance tests here if you don't mind.
Thanks to this patch caching the hash code or not doesn't depend on
the hash functor to be empty of final anymore. I only keep the default
constructible condition so that local_iterator can be default
constructible, considering it is a Standard request.
2012-12-14 François Dumont <fdumont@gcc.gnu.org>
* include/bits/hashtable_policy.h (_Local_iterator_base): Use
_Hashtable_ebo_helper to embed necessary functors into the
local_iterator. Pass information about functors involved in hash
code by copy.
* include/bits/hashtable.h (__cache_default): Cache only if the
hash functor is not noexcept qualified or if it is slow or if the
hash functor do not expose a default constructor.
* include/debug/unordered_set
(std::__debug::unordered_set<>::erase): Detect local iterators to
invalidate using contained node rather than generating a dummy
local_iterator instance.
(std::__debug::unordered_multiset<>::erase): Likewise.
* include/debug/unordered_map
(std::__debug::unordered_map<>::erase): Likewise.
(std::__debug::unordered_multimap<>::erase): Likewise.
* testsuite/performance/23_containers/insert_erase/41975.cc: Test
std::tr1 and std versions of unordered_set regardless of any
macro. Add test on default cache behavior.
* testsuite/performance/23_containers/insert/54075.cc: Likewise.
* testsuite/23_containers/unordered_set/instantiation_neg.cc:
Adapt line number.
* testsuite/23_containers/unordered_set/
not_default_constructible_hash_neg.cc: New.
* testsuite/23_containers/unordered_set/buckets/swap.cc: New.
Tested under Linux x86_64, normal and debug modes.
Ok to commit ?
François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtable.patch
Type: text/x-patch
Size: 36141 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20121213/af554528/attachment.bin>
More information about the Libstdc++
mailing list