Skip to content

set fixed iteration count for benchmarks #982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion benchmark/benchmark.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ struct alloc_data {
->ArgNames( \
BENCHMARK_PRIVATE_CONCAT_NAME(BaseClass, Method)::argsName()) \
->Name(BENCHMARK_PRIVATE_CONCAT_NAME(BaseClass, Method)::name()) \
->MinWarmUpTime(1)
->Iterations( \
BENCHMARK_PRIVATE_CONCAT_NAME(BaseClass, Method)::iterations())

class fixed_alloc_size : public alloc_size_interface {
public:
Expand Down Expand Up @@ -238,6 +239,7 @@ class alloc_benchmark : public benchmark_interface<Size, Alloc> {
return res;
}
static std::string name() { return base::name() + "/alloc"; }
static int64_t iterations() { return 200000; }

protected:
using base = benchmark_interface<Size, Alloc>;
Expand Down Expand Up @@ -324,6 +326,7 @@ class multiple_malloc_free_benchmark : public alloc_benchmark<Size, Alloc> {
res.insert(res.end(), n.begin(), n.end());
return res;
}
static int64_t iterations() { return 2000; }
std::default_random_engine generator;
distribution dist;
};
Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmark_interfaces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct benchmark_interface : public benchmark::Fixture {
return res;
}
static std::string name() { return Allocator::name(); }

static int64_t iterations() { return 10000; }
Size alloc_size;
Allocator allocator;
};
Expand Down
Loading