[PATCH] D54390: [llvm-exegesis] InstructionBenchmarkClustering::rangeQuery(): write into llvm::SmallVectorImpl& output parameter

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 12 00:00:00 PST 2018


lebedev.ri added a comment.

In https://reviews.llvm.org/D54390#1294939, @MaskRay wrote:

> LG. The issue is that there shouldn't be frequent `SmallVector` construction/destruction in the loop body.
>
> Here comes my own question: when the specific vector type does not matter too much (as in this case), when shall we choose `SmallVector` and when `std::vector`?


If there are preexisting contract/interface requirements - the one required by the contract/interface.
Else, if there are no concerns about memory usage, but the element count is hard to guess, `SmallVector` is much better because it doubles it's capacity.


Repository:
  rL LLVM

https://reviews.llvm.org/D54390





More information about the llvm-commits mailing list