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
Yield before flushing io buffers in fsync (sys_fs) #5506
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really necessary to even log this as warning? Its essentially supposed to be a NOP on a desktop OS and should have no side-effect anyway.
You should probably mention this on the comment itself, otherwise no one guarantees some years from now no one will accidentally do that mistake again |
GOW 3 Demo now loads to menu much faster 👍 |
@AniLeo Provided the reason for commenting out. |
It's not unnecessary, it's important to ensure consistent state of written files in the case of power loss events and similar disasters. It's not related at all to the write visibility. The question would be, why it's ever used by a game and what files it's used for. |
In gow3 this is used after every 1mb write to a specific file, we can't fix game code logic. |
I'd try to release the thread with lv2_obj::sleep before the sync. There are more things to consider. |
how much time do you think the thread should sleep, or only for yield? |
It doesn't need timeout. Just sleep(ppu), it should reschedule after the syscall returns. |
Added the requested reschedule/yield. |
I'd like to test it without removing the sync. |
are you for real? |
I wonder if making fsync asynchronous would help. |
@Nekotekina Give me one reason the file buffers flushing is still needed in the emulator. |
GoW3 Demo loading time improved by a lot, takes only a couple dozen seconds to reach title screen. Tests on FX8350 |
https://blogs.msdn.microsoft.com/oldnewthing/20100909-00/?p=12913
File buffers flushing waits for the disk to push data to the disk, and on windows also waits for the disk to clear its cache.
This is an extremely performance expensive operation, atleast deschedule when doing it.
Thanks for jarves and yahfz for testing and the fix.