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

Avoid allocation in ScopedTimer call #54

Conversation

wrenge
Copy link
Contributor

@wrenge wrenge commented Feb 18, 2024

Calling ScopedTimer will cause 3 allocations:

  1. Capturing label in lambda
  2. Creating lambda itself
  3. Boxing allocation for casting struct into interface

It would be better to avoid such allocations in code which executes every game tick.

@ikpil ikpil changed the base branch from main to pr/telemetry-disposable-alloc-fix February 19, 2024 15:52
@ikpil ikpil merged commit 3158dfc into ikpil:pr/telemetry-disposable-alloc-fix Feb 19, 2024
2 checks passed
@ikpil
Copy link
Owner

ikpil commented Feb 19, 2024

Thanks for providing the insight!! @wrenge

@wrenge wrenge deleted the pr/telemetry-disposable-alloc-fix branch February 20, 2024 11:08
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.

None yet

2 participants