[physfs] [patch] Do not fsync read-only file descriptors on Posix
Andreas Karlsson
andreas at proxel.se
Tue Aug 20 19:28:34 EDT 2013
Hi,
When debugging why a game was slow at starting on Linux I noticed that
most of the time was spent in fsync calls from PhysicsFS. This was due
to fsync calls on files opened with O_RDONLY causing flushes to disk of
the access time changes (atime). See this forum thread for details of my
debugging.[1] In most modern Linux distros relatime makes sure access
times are only updated once, but not all Posix OSes has relatime and a
slow first startup is not something good anyway.
The Windows version of __PHYSFS_platformFlush already checks if the file
is opened read-only or not (presumably to solve the same problem) so I
just added the equivalent check to the Posix version.
I have attached two patches, one against stable-2.0 and one against default.
Best regards,
Andreas
Footnotes
---
1.
http://forum.paradoxplaza.com/forum/showthread.php?709094-Slow-game-startup-on-Linux-and-what-tracing-reveals
--
Andreas Karlsson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: norofsync2.1.diff
Type: text/x-patch
Size: 490 bytes
Desc: not available
URL: <http://icculus.org/pipermail/physfs/attachments/20130821/f2680b1c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: norofsync2.0.diff
Type: text/x-patch
Size: 467 bytes
Desc: not available
URL: <http://icculus.org/pipermail/physfs/attachments/20130821/f2680b1c/attachment-0001.bin>
More information about the physfs
mailing list