From b1210c059d1ef084ecd275ed0ffb8343ac3cdfad Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Sun, 26 Jul 2020 14:05:00 +0300 Subject: [PATCH] [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. --- llvm/tools/llvm-xray/xray-account.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/llvm/tools/llvm-xray/xray-account.h b/llvm/tools/llvm-xray/xray-account.h index b63ecc59b71ad..575114d6096a2 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> FunctionLatencyMap; - typedef std::map> + typedef llvm::DenseMap> + FunctionLatencyMap; + typedef llvm::DenseMap> PerThreadMinMaxTSCMap; - typedef std::map> PerCPUMinMaxTSCMap; - typedef std::vector> FunctionStack; - typedef std::map PerThreadFunctionStackMap; + typedef llvm::DenseMap> + PerCPUMinMaxTSCMap; + typedef llvm::SmallVector, 32> FunctionStack; + typedef llvm::DenseMap PerThreadFunctionStackMap; private: PerThreadFunctionStackMap PerThreadFunctionStack;