New issue
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
Schedule executor benchmark #12873
base: main
Are you sure you want to change the base?
Schedule executor benchmark #12873
Conversation
|
||
fn s_system<const N: usize>() { | ||
let now = Instant::now(); | ||
while Instant::now() - now < Duration::from_nanos(1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we use something like tokio::time::sleep?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My initial thoughts was I just needed a short-lived system,I want to measure the cost of each batch(with different system count) spawned by the schedule.why should we use something like tokio::time::sleep?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or just time::sleep() sorry; which seems to do the same as your function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, time::sleep is clearer here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sleep yields to the OS, which can be nondeterministic and bound by the minimum quanta established by the OS, which can be tens to hundreds of microseconds off. This may not be what we want in a benchmark.
let mut group = c.benchmark_group("executor"); | ||
group.warm_up_time(std::time::Duration::from_millis(500)); | ||
group.measurement_time(std::time::Duration::from_secs(4)); | ||
group.bench_function("single-thread", |b| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this is running 16 systems in a chain?
I think it would be worht having a small explaining what the benchmark is doing.
Would it be worth trying with more systems?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, it should have a comment ,but more systems usually seems do not affect the result of benchmark,adding more system only increase time linearly.
Objective
Solution