-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Make the Benchmark class public #2101
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
Conversation
|
I like this change a lot, it's always bothered me that we expose "internal". The window failures look like legitimate issues @jmr . |
e145307 to
0e05338
Compare
|
this looks good, but will users of the library see broken builds if they're using |
Only with |
|
ok, this LGTM, but i'd like a second maintainer to take a look given it's an API change: @LebedevRI i think we'll need a release after this too. |
It's an ABI change, but the old API continues to work.
Why? Isn't |
|
only because there's been a few changes since the last release and this is relatively significant. also it's nicer to import internally point releases rather than commit SHAs. |
|
If i'm quite honest, this looks like a change just for the sake of change.
|
|
we should probably fix those too, in follow-ups. I agree with the author that we shouldn't have a public API that has the |
include/benchmark/benchmark.h
Outdated
| // Define alias of ThreadRunner factory function type | ||
| using threadrunner_factory = | ||
| std::function<std::unique_ptr<ThreadRunnerBase>(int)>; | ||
|
|
||
| typedef void(Function)(State&); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing typedefs for these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these intended to be user-facing? Maybe they should go back to internal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about Function, FunctionBenchmark and such,
but that whole threadrunner_factory thing
is clearly meant to be externally-avaliable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Move ::benchmark::internal::Benchmark to ::benchmark::Benchmark. It's a bit odd that the documented way to pass arguments to a benchmark is with `benchmark::internal::Benchmark`. Make this public instead. https://github.com/google/benchmark/blob/v1.9.4/docs/user_guide.md#passing-arguments https://raw.githubusercontent.com/google/benchmark/refs/tags/v1.9.4/docs/user_guide.md#:~:text=void%20CustomArguments(benchmark%3A%3A-,internal%3A%3ABenchmark,-*%20b)%20%7B%0A%20%20for%20(int Keep ::benchmark::internal::Benchmark as a deprecated forwarding alias. Uses of Benchmark in the internal namespace need to explicitly use ::benchmark::Benchmark to avoid the deprecation warning.
LebedevRI
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the point, but sure.
The main point is that the internal Google benchmark doesn't use Secondarily, if internal doesn't mean anything, I don't know what to think. |
Move ::benchmark::internal::Benchmark to ::benchmark::Benchmark.
It's a bit odd that the documented way to pass arguments to a benchmark is with
benchmark::internal::Benchmark. Make this public instead.https://github.com/google/benchmark/blob/v1.9.4/docs/user_guide.md#passing-arguments
https://raw.githubusercontent.com/google/benchmark/refs/tags/v1.9.4/docs/user_guide.md#:~:text=void%20CustomArguments(benchmark%3A%3A-,internal%3A%3ABenchmark,-*%20b)%20%7B%0A%20%20for%20(int
Keep ::benchmark::internal::Benchmark as a deprecated forwarding alias. Uses of Benchmark in the internal namespace need to explicitly use ::benchmark::Benchmark to avoid the deprecation warning.