-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Added a benchmark for game logic #10281
Conversation
|
||
using namespace OpenRCT2; | ||
|
||
static void BM_gamelogic(benchmark::State& state, IContext* context) |
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.
Why can't it use the standard form
for (auto _ : state)
{
context->GetGameState()->UpdateLogic();
}
?
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.
Actually, you found the problem with my code, you actually need this. Why?
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.
The loop is actually measuring the time, you don't need your timer. I'm just not sure it is safe to call context->GetGameState()->UpdateLogic()
repeatedly in a loop.
Other than the comment I posted above:
The xcode failure needs to be handled by someone with access to xcode. Ping @AaronVanGeffen @Gymnasiast |
That's not what I meant. I think in current form it will cause problems because you enabled manual timing and provide your own measurements, while all this should be handled by |
It is not necessary to do manual timing. But it works nonetheless and it is one of the examples in the documentation of the Google Benchmark library. |
Since it is not necessary, I would prefer to use the simpler invocation |
… work. Still need to figure out what to do with CPU iterations. The command to be called is openrct2 benchlogic xxx.sv6
@frutiemax I've rebased this PR and pushed a fix for the Xcode project. Do you intend to continue to work on this? |
|
||
using namespace OpenRCT2; | ||
|
||
static void BM_gamelogic(benchmark::State& state, IContext* context) |
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.
The loop is actually measuring the time, you don't need your timer. I'm just not sure it is safe to call context->GetGameState()->UpdateLogic()
repeatedly in a loop.
|
||
using namespace OpenRCT2; | ||
|
||
static void BM_gamelogic(benchmark::State& state, IContext* context) |
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.
You also don't need to call the function with BM_
prefix.
This is essentially doing the same thing as #10700. We need to decide which to merge. |
Google benchmark parameters seem to work. Still need to figure out what to do with CPU iterations. The command to be called is openrct2 benchlogic xxx.sv6