Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves the performance of
fs
module when reading files in particular for the file stream implementation.By refactoring the
fs
file stream and preferringstd::fs::File
instead of its tokio async variant, thefs
module performance improves significantly when doing file io reads resulting in~79%
more req/sec using~57%
less memory in Linux (according to my tests). However, a similar result should also be expected in Unix targets.Results
Here is a generic benchmark in Linux just to illustrate.
The
examples/file.rs
was used in the tests.Basically,
~79.33%
more requests per second utilizing~57.14%
less memory.Context
Below I highlight a quote from the Tokio website talking about Linux
io_uring
support which I think is self-explanatory.Credits
Not all are mine, there are other people involved in making this possible like the https://github.com/weihanglo/sfz project (inspiration) as well as contributors to SWS.
--
We're enjoying this optimization in SWS so that's why I share it with the warp folks too 😅.
Let me know what are your thoughts on this.