From 8aecb0c489e38fc08e40295f30932b17f1899059 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Mon, 19 Nov 2018 13:28:22 +0000 Subject: [llvm-exegesis] InstructionBenchmarkClustering::rangeQuery(): use llvm::SmallVector for storage. Summary: Old: (D54383) ``` Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (10 runs): 9098.781978 task-clock (msec) # 1.000 CPUs utilized ( +- 0.16% ) ... 9.1015 +- 0.0148 seconds time elapsed ( +- 0.16% ) ``` New: ``` Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (10 runs): 8553.352480 task-clock (msec) # 1.000 CPUs utilized ( +- 0.12% ) ... 8.5539 +- 0.0105 seconds time elapsed ( +- 0.12% ) ``` So another -6%. That is because the `SmallVector` **doubles** it size when reallocating, which is great here, since we can't `reserve()` since we can't know how many `Neighbors` we will have. Reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D54388 llvm-svn: 347200 --- llvm/tools/llvm-exegesis/lib/Clustering.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'llvm/tools/llvm-exegesis/lib/Clustering.cpp') diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.cpp b/llvm/tools/llvm-exegesis/lib/Clustering.cpp index f61bfbc3160..9ff4c029ab3 100644 --- a/llvm/tools/llvm-exegesis/lib/Clustering.cpp +++ b/llvm/tools/llvm-exegesis/lib/Clustering.cpp @@ -9,6 +9,7 @@ #include "Clustering.h" #include "llvm/ADT/SetVector.h" +#include "llvm/ADT/SmallVector.h" #include namespace llvm { @@ -32,9 +33,9 @@ namespace exegesis { // Finds the points at distance less than sqrt(EpsilonSquared) of Q (not // including Q). -std::vector +llvm::SmallVector InstructionBenchmarkClustering::rangeQuery(const size_t Q) const { - std::vector Neighbors; + llvm::SmallVector Neighbors; const auto &QMeasurements = Points_[Q].Measurements; for (size_t P = 0, NumPoints = Points_.size(); P < NumPoints; ++P) { if (P == Q) -- cgit v1.2.3