Skip to content

Commit 15f30e7

Browse files
authored
[libc++] Fix the batch size used in the std::gcd benchmark (llvm#120618)
Since that benchmark is testing n*n inputs, the batch size reported to GoogleBenchmark should be that amount. Otherwise, GoogleBenchmark reports the timing for calling std::gcd on the whole sequence, which is misleading.
1 parent 6e6f89c commit 15f30e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libcxx/test/benchmarks/numeric/gcd.bench.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static std::array<T, 1000> generate(std::uniform_int_distribution<T> distributio
2525

2626
static void bm_gcd_random(benchmark::State& state) {
2727
std::array data = generate<int>();
28-
while (state.KeepRunningBatch(data.size()))
28+
while (state.KeepRunningBatch(data.size() * data.size()))
2929
for (auto v0 : data)
3030
for (auto v1 : data)
3131
benchmark::DoNotOptimize(std::gcd(v0, v1));

0 commit comments

Comments
 (0)