-
- Downloads
c++: record template specialization hash
A lot of compile time of template-heavy code is spent in re-hashing
hashtable elements upon expansion. The following records the hash in the
hash element. This speeds up C++20 compilation of stdc++.h by about 25% for
about a 0.1% increase in memory usage.
With the hash value in the entry, we don't need to pass it separately to the
find functions.
Adding default arguments to the spec and hash fields simplifies spec_entry
initialization and avoids problems from hash starting with an indeterminate
value.
gcc/cp/ChangeLog:
* cp-tree.h (spec_entry::hash): New member.
* pt.cc (spec_hasher::hash): Set it and return it.
(maybe_process_partial_specialization): Clear it when
changing tmpl/args.
(lookup_template_class): Likewise, don't pass hash to find.
(retrieve_specialization): Set it, don't pass hash to find.
(register_specialization): Don't pass hash to find.
(reregister_specialization): Likewise.
(match_mergeable_specialization): Likewise.
(add_mergeable_specialization): Likewise.
Co-authored-by:
Richard Biener <rguenther@suse.de>
Loading
Please register or sign in to comment