aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.cc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2024-10-03 16:29:20 -0400
committerJason Merrill <jason@redhat.com>2024-10-03 21:43:21 -0400
commit5dad738c1dd1649a85d04a56f93d0ea229c9590f (patch)
treefe7e97a17f805f6353093069b375451c4a56010a /gcc/cp/parser.cc
parente175fb380a33537b3ea7056fead1e6ed25309dc1 (diff)
downloadgcc-5dad738c1dd1649a85d04a56f93d0ea229c9590f.zip
gcc-5dad738c1dd1649a85d04a56f93d0ea229c9590f.tar.gz
gcc-5dad738c1dd1649a85d04a56f93d0ea229c9590f.tar.bz2
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>
Diffstat (limited to 'gcc/cp/parser.cc')
0 files changed, 0 insertions, 0 deletions