Skip to content
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

Use setvbuf and allocate a heap buffer on file access #7

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

Conversation

davidgfnet
Copy link

This works around the default 1KB buffer that 3DS newlib has, which makes I/O slow. With this "hack" I mean, workaround, load times are reduced to 25% (around 3-4x faster), making the experience enjoyable. Level loading times around around 4-6 seconds (vs ~25s).

This is a hack, ideally some intermediate loading method should be added for consoles that do not have enough ram to load the entire datapack but have enough memory to load a significant amount of it (i.e. an LRU buffer cache or something).

This works around the default 1KB buffer that 3DS newlib has, which
makes I/O slow. With this "hack" I mean, workaround, load times are
reduced to 25% (around 3-4x faster), making the experience enjoyable.
Level loading times around around 4-6 seconds (vs ~25s).

This is a hack, ideally some intermediate loading method should be added
for consoles that do not have enough ram to load the entire datapack but
have enough memory to load a significant amount of it (i.e. an LRU
buffer cache or something).
@obscurerev
Copy link

Please push this fix! 🙏

@Mefiresu
Copy link

Mefiresu commented Sep 9, 2023

Interesting workaround!
Though I'm not quite sure if the o3DS has enough RAM left to fit some of the bigger files entirely in memory?
Also do you mind if I steal this idea for my Wii port?

@davidgfnet
Copy link
Author

After playing a bit more, maybe I should cap the buffer at 512KB or so, or exclude ogg/ogv files. Theres a small 400ms freeze when the audio track changes.

@Mefiresu
Copy link

Mefiresu commented Sep 9, 2023

After playing a bit more, maybe I should cap the buffer at 512KB or so, or exclude ogg/ogv files. Theres a small 400ms freeze when the audio track changes.

The audio freeze is mostly due to the asynchronous load not being implemented yet.

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.

3 participants