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

Memcpy and heap allocations in DtCrowdTelemetry.Stop() #51

Closed
wrenge opened this issue Feb 16, 2024 · 1 comment
Closed

Memcpy and heap allocations in DtCrowdTelemetry.Stop() #51

wrenge opened this issue Feb 16, 2024 · 1 comment

Comments

@wrenge
Copy link
Contributor

wrenge commented Feb 16, 2024

This causes the entire list to be copied over. It's pretty slow, if we going to do this every game cycle.

if (s.Count == TIMING_SAMPLES)
{
    s.RemoveAt(0);
}

This is Linq call and will cause memory allocation. Would be nice to avoid that, especially in a code that supposed to measure performance.

_executionTimings[name] = (long)s.Average();

I would replace List with some sort of cyclic buffer to avoid removing elements and replace Linq query with foreach cycle or even SIMD.

@ikpil
Copy link
Owner

ikpil commented Feb 17, 2024

Merged! Thank you for your contribution! @wrenge

@ikpil ikpil closed this as completed Feb 17, 2024
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

No branches or pull requests

2 participants