7 karma · joined Dec 15, 2023 (2y ago) · 2 submissions
comment 2y ago · link · parent
The difficulty comes from APIs ability to expose that buffer pool nicely. I am on the lookout to model this better, but no clear solution that does not make assumptions about the backend at play.
For now, however, with careful design you can skip the allocated buffers and supply a stack reference. So long as you have assurances the stack wont move (Rust's pinning guarantee), you should be able to pass that reference to the io system without problems. Not saying this results in zero copies being made - the backend usually has strict alignment requirements and alike, but hey, we at least get rid of one allocation!
comment 2y ago · link · parent
If you do any non-sequential processing, let's say a database, then you can see standard library show its weaknesses - feeding the operating system with multiple requests becomes more efficient than waiting for each request to finish in the synchronous std case.