flyingpot / tokio-goroutine-perf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tokio-goroutine-perf

Some of the code are from here.

Rust results:

cargo run --release

Go result:

go run goroutine.go

However, this benchmark cannot represent I/O performance result. Because /dev/urandom read and /dev/null write cannot trigger any I/O systemcall.

The Rust thread is slow because the cost of thread creation. And why block tokio is faster than unblock one is that this read and write is not blocking, so unblock tokio will make task switch more.

About

License:MIT License


Languages

Language:Rust 83.1%Language:Go 16.9%