ratarmount icon indicating copy to clipboard operation
ratarmount copied to clipboard

Use pread

Open mxmlnkn opened this issue 2 years ago • 2 comments

Currently, StenciledFile and other locations use locks to avoid race conditions between seek and read calls. I'm not sure why I never though of pread before but it might improve performance for multi-threaded access and even if not, it should simplify the code by removing the lock.

mxmlnkn avatar Nov 22 '22 21:11 mxmlnkn

One reason why os.pread is not always possible is the recursion. In those cases the reading has to be done on pure Python file-like objects for which pread cannot be used. But, it should still be possible to implement as a fast-path for real files.

mxmlnkn avatar Nov 23 '22 13:11 mxmlnkn