Skip to content

[GEN][ZH] Refactor the recorder class to use a ramfile for replay playback. #1233

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Mauller
Copy link

@Mauller Mauller commented Jul 6, 2025

This PR converts the Recorder class to use the game file system for replay loading and playback.

This was required to allow the use of a RAMFile which allows the replay to be fully loaded into ram while being accessed through the common file handling interface.

This will need some testing in headless playback, i saw a small improvement in replay playback times under normal circumstances. But the biggest improvements will likely be under headless mode.

When other bottlenecks are removed in future, this change should show bigger contributions to replay playback speed.

@Mauller
Copy link
Author

Mauller commented Jul 6, 2025

@helmutbuhler @roossienb Would be worth giving this a test under headless to see what impact it has overall.

@Mauller Mauller self-assigned this Jul 6, 2025
@Mauller Mauller added Gen Relates to Generals ZH Relates to Zero Hour Refactor Edits the code with insignificant behavior changes, is never user facing Major Severity: Minor < Major < Critical < Blocker labels Jul 6, 2025
@helmutbuhler
Copy link

@helmutbuhler @roossienb Would be worth giving this a test under headless to see what impact it has overall.

I did 4 runs with several replays in sequential order for each run. 2 runs without this PR, 2 runs with this PR:
Total time of all replays in each run without this PR: 0:08:51 and 0:09:04
With this PR: 0:08:44 and 0:08:49

The times in more details are here:
ramtest.zip

So is this a significant improvement or just random noise? I don't know...

But I should also mention that I don't see any significant diskaccess when simulating replays, not even when doing 24 replays in parallel.

@Mauller
Copy link
Author

Mauller commented Jul 7, 2025

That is fair, we should see more improvements coming from this change when other bottlenecks during playback are removed.

There won't be significant amounts of disk access overall, it's just the fact it's a lot of small reads that happen. Which most drives don't like, but overall reading from disk is always a bottleneck compared to RAM.

This refactor also makes the playback file handling code easier to understand as well. The writing code is another matter entirely but i left that in place to use the original m_file and it is not that big an issue to convert it over to use the game file system.

@Mauller Mauller marked this pull request as ready for review July 7, 2025 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gen Relates to Generals Major Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing ZH Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants