Before we move onto simplifying async files in Rust, it's important to learn in which areas the current implementations need improvement. This might surprise you... 1/9
-
-
My advice is to avoid async files in Rust altogether because they're inefficient and full of pitfalls (unless you use rio). Use them only in situations when you know what you're doing, if ever. Things might get different in the future, but that is what I advise *today*. 8/9
Show this thread -
If you want to read or write files inside async programs, spawn a blocking task using async_std::task::spawn_blocking() or tokio::task::spawn_blocking() and do synchronous I/O in there. That's the only easy, efficient, and reliable way of doing file I/O today. 9/9pic.twitter.com/Fwg1rCd368
Show this thread
End of conversation
New conversation -
-
-
Though need to mention that this would work only on Linux starting 5.5..
-
New conversation -
-
-
rio at the moment, and this is not criticism on
@sadisticsystems outstanding work, can be slightly slower then a boring serial read. Mind you not by a lot, but if you don’t read multiple fillies at once a simple std::io is still really good -
Yeah, it's the early days for sure, and there's lots of low hanging fruit to optimize, but over time io_uring based approaches should strictly dominate for any high throughout workloads
- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.