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.
could we use something like tokio::time::sleep?
There was a problem hiding this comment.
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.
or just time::sleep() sorry; which seems to do the same as your function
There was a problem hiding this comment.
Yeah, time::sleep is clearer here :)
There was a problem hiding this comment.
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.
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.
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