We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TL;DR: restricting a simple essentially sequential ping-pong program to run on a single core reduces performance by an order of magnitude.
Full reproduction here:
https://github.com/matklad/repros/tree/master/ping-pong
The program in question:
const N: u64 = 1_000_000; use crossbeam_channel::{Receiver, Sender}; pub fn main() { let t = std::time::Instant::now(); let (a_to_b, b_from_a) = crossbeam_channel::bounded(0); let (b_to_a, a_from_b) = crossbeam_channel::bounded(0); std::thread::scope(|scope| { scope.spawn(move || worker(true, a_from_b, a_to_b)); scope.spawn(move || worker(false, b_from_a, b_to_a)); }); eprintln!("{:?}", t.elapsed()); } fn worker(init: bool, receiver: Receiver<u64>, sender: Sender<u64>) { if init { sender.send(0).unwrap(); } for x in receiver { if x == N { break; } sender.send(x + 1).unwrap(); } }
$ ./target/release/ping-pong 377.409207ms $ taskset --cpu-list 1 ./target/release/ping-pong 5.058068466s
As a sanity check, the equivalent Go program (in the repro repo) takes approximately the same time on any number of cores.
The text was updated successfully, but these errors were encountered:
Ahhh, I think I've rediscovered #821 basically!
Sorry, something went wrong.
Does std mpsc has the same issue?
cc @ibraheemdev
I'm working on an idea that should hopefully fix a lot of these related issues.
No branches or pull requests
TL;DR: restricting a simple essentially sequential ping-pong program to run on a single core reduces performance by an order of magnitude.
Full reproduction here:
https://github.com/matklad/repros/tree/master/ping-pong
The program in question:
As a sanity check, the equivalent Go program (in the repro repo) takes approximately the same time on any number of cores.
The text was updated successfully, but these errors were encountered: