hyperium / h2

HTTP 2.0 client & server implementation for Rust.
MIT License
1.34k stars 265 forks source link

Add a simple benchmark #762

Closed trungda closed 2 months ago

trungda commented 2 months ago

This PR adds a simple benchmark to measure perf improvement changes. E.g., a potential fix for this issue: https://github.com/hyperium/h2/issues/531

The benchmark is simple: have a client send 100_000 requests to a server and wait for a response.

Output:

cargo bench
H2 running in current-thread runtime at 127.0.0.1:5928:
Overall: 353ms.
Fastest: 91ms
Slowest: 315ms
Avg    : 249ms
H2 running in multi-thread runtime at 127.0.0.1:5929:
Overall: 533ms.
Fastest: 88ms
Slowest: 511ms
Avg    : 456ms