Skip to content

Optimising frame stack with contiguous memory #618

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

Conversation

pseudo-rnd-thoughts
Copy link
Member

@pseudo-rnd-thoughts pseudo-rnd-thoughts commented May 30, 2025

With the bugs fixed, I now have the joy of optimising the implementation.
Previously, a std::deque was used and for each frame, it was popped then new memory allocated for the frame.

This PR optimises the frame stacking to have a single array of contiguous memory that acts like a circular / ring buffer such that we just overwrite the old frame with the new frame and write the frames oldest to newest

num-envs main steps per second PR steps per second
16 11300 11346
64 14100 15168
128 16750 17311

@pseudo-rnd-thoughts pseudo-rnd-thoughts merged commit 1d6b3c5 into Farama-Foundation:master Jun 1, 2025
34 checks passed
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

Successfully merging this pull request may close these issues.

1 participant