[PATCH] D20930: Adding reserve and capacity methods to FoldingSet
Ben Craig via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 2 14:31:17 PDT 2016
bcraig created this revision.
bcraig added reviewers: bkramer, chandlerc, mehdi_amini.
bcraig added a subscriber: llvm-commits.
When a hash table becomes too heavily loaded, it needs to grow and rebucket everything. This is very expensive for large tables, as it completely trashes the cache. Rehashing everything isn't cheap either.
This patch makes it possible to reserve space in FoldingSet, much as one would do with a std::vector. New unit tests were also added.
The clang static analyzer will likely be the first client of this change. Reserving nodes up front yields a 6.4% analysis speedup on a large .C file.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 6180 bytes
Desc: not available
More information about the llvm-commits