Skip to content
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

General optimisation #477

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

General optimisation #477

wants to merge 12 commits into from

Conversation

atidot3
Copy link
Contributor

@atidot3 atidot3 commented Aug 14, 2024

Replaced alot of std::string copy by string_view and function prototype with references.
Rework helpers with modern c++ 20

@liyunfan1223
Copy link
Owner

Looks good to me. Have you done any performance testing to see how much of a performance gain?

@atidot3
Copy link
Contributor Author

atidot3 commented Aug 15, 2024

Its a grain of salt in the all process but it reduce allocation so its never bad :)

@liyunfan1223
Copy link
Owner

I believe it's more than a grain of salt. String copy overhead (and string hash in something like map<std::string, ...>) is really terrible based on my performance test. But most of them can be optimized with a better coding approach.

I just feel that any modification should have a clear benefit, not just that way it looks good. Modification is always risky, and if there is no exact benefit, it should not be touched.

@atidot3
Copy link
Contributor Author

atidot3 commented Aug 15, 2024

I mean based on the sources size of the module its a small amont of required changes, you cant test optimisation with only small amount of changes like this on few strings.

Its a long process as containers need to be changed to use also refs and views.

Small commit by small commit

@liyunfan1223
Copy link
Owner

We are not talking about the same thing. You don't need to optimize everything, no. You only need to optimize the critical part, in other words performance bottleneck. If you don't even know where the bottleneck is, figure it out first.

@atidot3
Copy link
Contributor Author

atidot3 commented Aug 16, 2024

image

Both run at 1000 bots for 10 minutes.
On the optimise side the cpu is at a lower usage and seem to cycle more per cycle on UpdateAIInternal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants