From: David Blaikie Date: Tue, 11 Jul 2017 01:18:28 +0000 (+0000) Subject: llvm-profdata: Improve memory usage by tuning SmallDenseMap size X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b67e9a22a0a3c868991cb7380bd76b831e06124;p=llvm llvm-profdata: Improve memory usage by tuning SmallDenseMap size This takes memory usage from 5.1GB to 970MB - it could go further by using a small size of 2 instead of the default of 4, but given the rather high cost of going over this limit by much, I figured a little slosh would be worth the ~130MB of memory usage. & this'll might not be such a big deal if we use a custom slab allocator for the DenseMaps here anyway While the vast majority (99.9%) of records use only 1 entry, the tuning parameter to SmallDenseMap is the the number of buckets, not the number of entries - so a small size of 1 wasn't useful, even for 1 element, it would tip over into allocating (much, 64 slots worth) more space - none of them ended up small. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307608 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ProfileData/InstrProfWriter.h b/include/llvm/ProfileData/InstrProfWriter.h index 11c3788cfda..8107ab386fe 100644 --- a/include/llvm/ProfileData/InstrProfWriter.h +++ b/include/llvm/ProfileData/InstrProfWriter.h @@ -33,8 +33,7 @@ class raw_fd_ostream; class InstrProfWriter { public: - using ProfilingData = - SmallDenseMap; + using ProfilingData = SmallDenseMap; enum ProfKind { PF_Unknown = 0, PF_FE, PF_IRLevel }; private: