Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

re0312
Copy link
Contributor

@re0312 re0312 commented Apr 4, 2024

Objective

  • currently ,bevy does not have a benchmark for its schedule executor

Solution

  • Added executor benchmark

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Benchmarks Stress tests and benchmarks used to measure how fast things are labels Apr 4, 2024

fn s_system<const N: usize>() {
let now = Instant::now();
while Instant::now() - now < Duration::from_nanos(1) {
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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

Copy link
Member

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 :)

Copy link
Member

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| {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Benchmarks Stress tests and benchmarks used to measure how fast things are
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants