Why timedemo is slow? Is there something capping it?
Setting demo.timedemo to on is expected to make the engine play the next demo frame as soon as the rendering is complete. This is expected to makes the demo being played as fast as the computer can do it. At the end a time and an average framerate is printed. It's useful to benchmark the game.
Though, my hardware can render a standard demo playing in a range around 400~1400fps, but when I play it in timedemo demo mode, I only get around 300fps.
I modified the engine to set the frametime to 0 (and fixed some bugs related to this) to make sure the engine doesn't idle every frame to fill at least 1ms in both modes.
I also modified the engine to count and print the frames on every demo end, whatever the playing mode, and I get:
| playing mode | frames | time | framerate | frametime |
|---|---|---|---|---|
| standard | 192624 | 313.8s | 613.8 fps | 1.629ms |
| timedemo | 6317 | 17.2s | 366.9 fps | 2.723ms |
The timedemo framerate is almost half the framerate in standard mode, so the timedemo frametime looks to be almost twice the frametime in standard mode.
The results may also be interpreted in a way that 1ms is always spent somewhere in timedemo mode. Though I have already set minMsec to 0 in src/engine/qcommon/common.cpp.
I found a function named Com_ModifyMsec() that prevents the frametime to be zero, if I skip it while timedemo mode is enabled, I get:
| playing mode | frames | time | framerate | frametime |
|---|---|---|---|---|
| timedemo | 6317 | 15.1s | 418.5 fps | 2.390ms |
Though that brings one bug: input isn't usable while timedemo mode is enabled (even if not playing demos).