[llvm] b1210c0 - [NFC][XRay] Account: migrate to DenseMap + SmallVector, -16% faster on large (3.8G) input

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 26 04:08:40 PDT 2020


Author: Roman Lebedev
Date: 2020-07-26T14:08:07+03:00
New Revision: b1210c059d1ef084ecd275ed0ffb8343ac3cdfad

URL: https://github.com/llvm/llvm-project/commit/b1210c059d1ef084ecd275ed0ffb8343ac3cdfad
DIFF: https://github.com/llvm/llvm-project/commit/b1210c059d1ef084ecd275ed0ffb8343ac3cdfad.diff

LOG: [NFC][XRay] Account: migrate to DenseMap + SmallVector, -16% faster on large (3.8G) input

DenseMap is a single allocation underneath, so this is has pretty expected
performance impact on large-ish (3.8G) xray log processing time.

Added: 
    

Modified: 
    llvm/tools/llvm-xray/xray-account.h

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-xray/xray-account.h b/llvm/tools/llvm-xray/xray-account.h
index b63ecc59b71a..575114d6096a 100644
--- a/llvm/tools/llvm-xray/xray-account.h
+++ b/llvm/tools/llvm-xray/xray-account.h
@@ -27,12 +27,14 @@ namespace xray {
 
 class LatencyAccountant {
 public:
-  typedef std::map<int32_t, std::vector<uint64_t>> FunctionLatencyMap;
-  typedef std::map<uint32_t, std::pair<uint64_t, uint64_t>>
+  typedef llvm::DenseMap<int32_t, llvm::SmallVector<uint64_t, 0>>
+      FunctionLatencyMap;
+  typedef llvm::DenseMap<uint32_t, std::pair<uint64_t, uint64_t>>
       PerThreadMinMaxTSCMap;
-  typedef std::map<uint8_t, std::pair<uint64_t, uint64_t>> PerCPUMinMaxTSCMap;
-  typedef std::vector<std::pair<int32_t, uint64_t>> FunctionStack;
-  typedef std::map<uint32_t, FunctionStack> PerThreadFunctionStackMap;
+  typedef llvm::DenseMap<uint8_t, std::pair<uint64_t, uint64_t>>
+      PerCPUMinMaxTSCMap;
+  typedef llvm::SmallVector<std::pair<int32_t, uint64_t>, 32> FunctionStack;
+  typedef llvm::DenseMap<uint32_t, FunctionStack> PerThreadFunctionStackMap;
 
 private:
   PerThreadFunctionStackMap PerThreadFunctionStack;


        


More information about the llvm-commits mailing list