I decided to strace minecraft for fun and giggles to find out that it does many read() system calls with a buffer length of 1, I found this kind of disturbing and decided to investigate. And I could only reproduce this by creating a 1 byte buffer to read into from Java. Now what's the bug? Well this seems kind of really weird, chunk files are padded to 4096 bytes, so why not read those in well 'chunks' of 4096 bytes instead? Causes less system calls and is in theory faster. Attached is a small portion of the strace where the odd read system call behavior is visible.
Linked issues
relates to 1
Attachments
Comments 6
Is this still a concern in the current Minecraft version 14w30c or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.
Is this still a concern in the current Minecraft version 1.8.1 Prerelease 3 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.
This sounds like a great candidate for the reason behind the jerky lag issue when travelling (loading new chunks) seemingly introduced in 1.8. Has any progress been made on this?
Technically the system calls would be a problem with the jvm as the implementation does not have direct access to system calls. That being said, what you are describing sounds much like MC-34464, in regards to inefficient file I/O.