Skip to content

Commit

Permalink
[NFC][XRay] Account: migrate to DenseMap + SmallVector, -16% faster o…
Browse files Browse the repository at this point in the history
…n 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.
  • Loading branch information
LebedevRI committed Jul 26, 2020
1 parent ed5a6b9 commit b1210c0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions llvm/tools/llvm-xray/xray-account.h
Expand Up @@ -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;
Expand Down

0 comments on commit b1210c0

Please sign in to comment.