[PATCH] D54388: [llvm-exegesis] InstructionBenchmarkClustering::rangeQuery(): use llvm::SmallVector<size_t, 0> for storage.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 11 17:09:15 PST 2018


MaskRay requested changes to this revision.
MaskRay added inline comments.
This revision now requires changes to proceed.


================
Comment at: tools/llvm-exegesis/lib/Clustering.cpp:38
 InstructionBenchmarkClustering::rangeQuery(const size_t Q) const {
-  std::vector<size_t> Neighbors;
+  llvm::SmallVector<size_t, 0> Neighbors;
   const auto &QMeasurements = Points_[Q].Measurements;
----------------
The size of `Neighbors` is bound by the number of points. The vector can be reserved before the loop calling `rangeQuery` and passed as a parameter into `rangeQuery`.


Repository:
  rL LLVM

https://reviews.llvm.org/D54388





More information about the llvm-commits mailing list