[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.
http://reviews.llvm.org/D20930
Files:
include/llvm/ADT/FoldingSet.h
lib/Support/FoldingSet.cpp
unittests/ADT/FoldingSet.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20930.59456.patch
Type: text/x-patch
Size: 6180 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160602/4c2813dc/attachment.bin>
More information about the llvm-commits
mailing list