GetElapsedDateTimeTicks bad performance

I’m attempting to find CPU bottlenecks in my game, and have hit the point where MonoGame is the slowest part. Specifically, it looks like GetElapsedDateTimeTicks() is taking a majority of the frame.

Is this a known bottleneck, and is there any way around it?

This is from a non-trivial game (doing quite a bit in Draw) on Windows (OpenGL) using MonoGame 3.7.1. I am profiling using the built in Visual Studio tools, and this is on a Release build of the game.

I’ve also uploaded the perf report here in case it is useful: https://1drv.ms/u/s!AuoP5BxngkOP7xpa4jmkmB8Pvu-w?e=cnmaCo

If you use FixedTimeStep (default true) monogame will actually do some Sleep in order to maintain 60 fps - maybe that’s what you see here

2 Likes

I am using FixedTimeStep. That totally makes sense (and I guess that means I am running faster than 60fps now :slight_smile:) . The profiler may just be getting a little confused about the GetTime vs the Sleep itself.

Thanks!