-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
A-tokioArea: The main tokio crateArea: The main tokio crateC-feature-requestCategory: A feature request.Category: A feature request.M-syncModule: tokio/syncModule: tokio/sync
Description
Motivation
Cache line optimization on mpsc.
Solution
Cacheline optimization on mpsc by using CachePadded.
Benchmark
The origin benchmark result:
$ cargo bench --bench sync_mpsc
running 10 tests
test contention_bounded ... bench: 1,008,359 ns/iter (+/- 412,814)
test contention_bounded_full ... bench: 1,427,243 ns/iter (+/- 500,287)
test contention_unbounded ... bench: 845,013 ns/iter (+/- 394,673)
test create_100_000_medium ... bench: 182 ns/iter (+/- 1)
test create_100_medium ... bench: 182 ns/iter (+/- 1)
test create_1_medium ... bench: 181 ns/iter (+/- 2)
test send_large ... bench: 16,525 ns/iter (+/- 329)
test send_medium ... bench: 628 ns/iter (+/- 5)
test uncontented_bounded ... bench: 478,514 ns/iter (+/- 1,923)
test uncontented_unbounded ... bench: 303,990 ns/iter (+/- 1,607)
test result: ok. 0 passed; 0 failed; 0 ignored; 10 measured
The current benchmark result:
$ cargo bench --bench sync_mpsc
running 10 tests
test contention_bounded ... bench: 606,516 ns/iter (+/- 402,326)
test contention_bounded_full ... bench: 727,239 ns/iter (+/- 340,756)
test contention_unbounded ... bench: 760,523 ns/iter (+/- 482,628)
test create_100_000_medium ... bench: 315 ns/iter (+/- 5)
test create_100_medium ... bench: 317 ns/iter (+/- 6)
test create_1_medium ... bench: 315 ns/iter (+/- 5)
test send_large ... bench: 16,166 ns/iter (+/- 516)
test send_medium ... bench: 695 ns/iter (+/- 6)
test uncontented_bounded ... bench: 456,975 ns/iter (+/- 18,969)
test uncontented_unbounded ... bench: 306,282 ns/iter (+/- 3,058)
test result: ok. 0 passed; 0 failed; 0 ignored; 10 measured
It also can been seen in #5829
Metadata
Metadata
Assignees
Labels
A-tokioArea: The main tokio crateArea: The main tokio crateC-feature-requestCategory: A feature request.Category: A feature request.M-syncModule: tokio/syncModule: tokio/sync