TODO: write a benchmark program
kamalmarhubi opened this issue · 4 comments
kamalmarhubi commented
Very curious about how this performs vs a threadpool + futures::sync::oneshot
.
asomers commented
Good question. Probably better, since it doesn't create any new OS threads.
kamalmarhubi commented
I remember reading this on the topic a while back, which is why I was curious: http://blog.libtorrent.org/2012/10/asynchronous-disk-io/
asomers commented
Interesting read. I didn't know about the alignment restrictions for libaio. That's going to cause problems for tokio-file.
asomers commented
I added a simple microbenchmark that does a single 4KB read using tokio-file. For comparison, I added another microbenchmark that does the same 4KB read using futures::sync::oneshot
in a new thread. On my system, POSIX AIO usually wins by about 4-5x. For example:
running 2 tests
test bench_aio_read ... bench: 7,069 ns/iter (+/- 210)
test bench_threaded_read ... bench: 33,967 ns/iter (+/- 287