ikpil / DotRecast

DotRecast - a port of Recast & Detour, Industry-standard navigation mesh toolset for .NET, C#, Unity3D, games, servers
zlib License
516 stars 70 forks source link

Avoid allocation in ScopedTimer call #54

Closed wrenge closed 7 months ago

wrenge commented 7 months ago

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 commented 7 months ago

Thanks for providing the insight!! @wrenge