Open vimpunk opened 3 years ago
Any time disk I/O perf is considered, OS caching/buffering must be taken into account.
As things stand with #95 , we use a user-space buffer, and then the OS does its own buffering. I think this double-buffer makes the data transfer slower than it might have been. So yeah, careful and ample benchmarking should become our mantra eventually, but for now it can wait.
In fact, we have not two, but three options to proceed:
FILE_FLAG_NO_BUFFERING
attribute on creating/opening. Some further info (sounds like aligment-aware allocations will be needed).Also, user-space buffering has its own optimizations to apply...
https://github.com/mandreyel/cratetorrent/pull/95 introduced a fallback for disk writes on other platforms. It currently uses a less efficient approach than the Linux positional vectored IO APIs as they are not present on other platforms.
There were two options for the fallback, quoting directly from the implementation:
We should benchmark which is actually faster at some point.