vasi/positioned-io

Windows implementation

Opened this issue · 2 comments

It looks like windows implementation has a huge overhead. Let's discuss possible performance improvements!

It seems like it should be possible to use WriteFileEx and completion API. This also gives the benefit of having the ability to perform the operations asynchronously.

Additionally, it seems like a good idea to investigate the IOCP (and io_uring on Linux) as a completion based APIs.

Overhead is much improved with the https://docs.rs/positioned-io-preview/0.3.4/positioned_io_preview/struct.RandomAccessFile.html wrapper from the preview branch.

From the readme of that branch:

Note: If possible use the RandomAccessFile wrapper. On Windows ReadAt directly on File is very slow.

But WriteFileEx etc. are still preferable, probably.

Yep, I think this crate should try to expose the best positioned IO API that the underlying system provides, as mmap is already covered elsewhere:
https://github.com/RazrFalcon/memmap2-rs/blob/master/src/windows.rs

That said, it would be nice to do some research to see if the positioned API on Windows is better or worse than mmap. I think it might be that all of the positioned APIs are just mmaps with extra steps under the hood - but there might also be the optimizations there...