From 8e315b66c261553d6023732fe112f55d62118a70 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Mon, 19 Nov 2018 13:28:36 +0000 Subject: [PATCH] [llvm-exegesis] Move InstructionBenchmarkClustering::isNeighbour() into header Summary: Old: (D54390) ``` 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): 7432.421721 task-clock (msec) # 1.000 CPUs utilized ( +- 0.15% ) ... 7.4336 +- 0.0115 seconds time elapsed ( +- 0.15% ) ``` 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): 6569.936144 task-clock (msec) # 1.000 CPUs utilized ( +- 0.22% ) ... 6.5711 +- 0.0143 seconds time elapsed ( +- 0.22% ) ``` And another -12%. You'd think it would be `inline`d anyway, but no! :) Reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn Reviewed By: courbet, MaskRay Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D54393 llvm-svn: 347203 --- llvm/tools/llvm-exegesis/lib/Clustering.cpp | 11 ----------- llvm/tools/llvm-exegesis/lib/Clustering.h | 9 ++++++++- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.cpp b/llvm/tools/llvm-exegesis/lib/Clustering.cpp index df45de3..360966a 100644 --- a/llvm/tools/llvm-exegesis/lib/Clustering.cpp +++ b/llvm/tools/llvm-exegesis/lib/Clustering.cpp @@ -49,17 +49,6 @@ void InstructionBenchmarkClustering::rangeQuery( } } -bool InstructionBenchmarkClustering::isNeighbour( - const std::vector &P, - const std::vector &Q) const { - double DistanceSquared = 0.0; - for (size_t I = 0, E = P.size(); I < E; ++I) { - const auto Diff = P[I].PerInstructionValue - Q[I].PerInstructionValue; - DistanceSquared += Diff * Diff; - } - return DistanceSquared <= EpsilonSquared_; -} - InstructionBenchmarkClustering::InstructionBenchmarkClustering( const std::vector &Points, const double EpsilonSquared) diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.h b/llvm/tools/llvm-exegesis/lib/Clustering.h index e746e4b..297651c 100644 --- a/llvm/tools/llvm-exegesis/lib/Clustering.h +++ b/llvm/tools/llvm-exegesis/lib/Clustering.h @@ -90,7 +90,14 @@ public: // Returns true if the given point is within a distance Epsilon of each other. bool isNeighbour(const std::vector &P, - const std::vector &Q) const; + const std::vector &Q) const { + double DistanceSquared = 0.0; + for (size_t I = 0, E = P.size(); I < E; ++I) { + const auto Diff = P[I].PerInstructionValue - Q[I].PerInstructionValue; + DistanceSquared += Diff * Diff; + } + return DistanceSquared <= EpsilonSquared_; + } private: InstructionBenchmarkClustering( -- 2.7.4