Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
robtfm committed May 17, 2022
1 parent 3de7c9a commit 17c5238
Show file tree
Hide file tree
Showing 180 changed files with 3,916 additions and 1,704 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:

miri:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
Expand All @@ -83,7 +84,7 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.toml') }}
key: ${{ runner.os }}-cargo-miri-${{ hashFiles('**/Cargo.toml') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

Hey, so you're interested in contributing to Bevy!
Feel free to pitch in on whatever interests you and we'll be happy to help you contribute.
Ultimately @cart has final say on which changes are merged, but you're welcome to try and convince him.

Check out our community's [Code of Conduct](https://github.com/bevyengine/bevy/blob/main/CODE_OF_CONDUCT.md) and feel free to say hi on [Discord](https://discord.gg/bevy) if you'd like.
It's a nice place to chat about Bevy development, ask questions, and get to know the other contributors and users in a less formal setting.
Expand Down
2 changes: 0 additions & 2 deletions assets/shaders/custom_material.vert
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ layout(set = 0, binding = 0) uniform CameraViewProj {
mat4 InverseView;
mat4 Projection;
vec3 WorldPosition;
float near;
float far;
float width;
float height;
};
Expand Down
27 changes: 22 additions & 5 deletions benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ rand = "0.8"
rand_chacha = "0.3"
criterion = { version = "0.3", features = ["html_reports"] }
bevy_ecs = { path = "../crates/bevy_ecs" }
bevy_reflect = { path = "../crates/bevy_reflect" }
bevy_tasks = { path = "../crates/bevy_tasks" }
bevy_utils = { path = "../crates/bevy_utils" }

[[bench]]
name = "archetype_updates"
Expand All @@ -24,11 +26,6 @@ name = "ecs_bench_suite"
path = "benches/bevy_ecs/ecs_bench_suite/mod.rs"
harness = false

[[bench]]
name = "system_stage"
path = "benches/bevy_ecs/stages.rs"
harness = false

[[bench]]
name = "run_criteria"
path = "benches/bevy_ecs/run_criteria.rs"
Expand All @@ -39,11 +36,31 @@ name = "commands"
path = "benches/bevy_ecs/commands.rs"
harness = false

[[bench]]
name = "system_stage"
path = "benches/bevy_ecs/stages.rs"
harness = false

[[bench]]
name = "world_get"
path = "benches/bevy_ecs/world_get.rs"
harness = false

[[bench]]
name = "reflect_list"
path = "benches/bevy_reflect/list.rs"
harness = false

[[bench]]
name = "reflect_map"
path = "benches/bevy_reflect/map.rs"
harness = false

[[bench]]
name = "reflect_struct"
path = "benches/bevy_reflect/struct.rs"
harness = false

[[bench]]
name = "iter"
path = "benches/bevy_tasks/iter.rs"
Expand Down
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/run_criteria.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use bevy_ecs::{
component::Component,
prelude::{ParallelSystemDescriptorCoercion, Res, RunCriteriaDescriptorCoercion},
schedule::{ShouldRun, Stage, SystemStage},
system::{IntoSystem, Query},
system::Query,
world::World,
};
use criterion::{criterion_group, criterion_main, Criterion};
Expand Down
155 changes: 155 additions & 0 deletions benches/benches/bevy_reflect/list.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
use std::{iter, time::Duration};

use bevy_reflect::{DynamicList, List};
use criterion::{
black_box, criterion_group, criterion_main, measurement::Measurement, BatchSize,
BenchmarkGroup, BenchmarkId, Criterion, Throughput,
};

criterion_group!(
benches,
concrete_list_apply,
concrete_list_clone_dynamic,
dynamic_list_apply,
dynamic_list_push
);
criterion_main!(benches);

const WARM_UP_TIME: Duration = Duration::from_millis(500);
const MEASUREMENT_TIME: Duration = Duration::from_secs(4);

// log10 scaling
const SIZES: [usize; 5] = [100_usize, 316, 1000, 3162, 10000];

fn list_apply<M, LBase, LPatch, F1, F2, F3>(
group: &mut BenchmarkGroup<M>,
bench_name: &str,
f_base: F1,
f_patch: F3,
) where
M: Measurement,
LBase: List,
LPatch: List,
F1: Fn(usize) -> F2,
F2: Fn() -> LBase,
F3: Fn(usize) -> LPatch,
{
for size in SIZES {
group.throughput(Throughput::Elements(size as u64));

group.bench_with_input(
BenchmarkId::new(bench_name, size),
&size,
|bencher, &size| {
let f_base = f_base(size);
let patch = f_patch(size);
bencher.iter_batched(
|| f_base(),
|mut base| base.apply(black_box(&patch)),
BatchSize::SmallInput,
);
},
);
}
}

fn concrete_list_apply(criterion: &mut Criterion) {
let mut group = criterion.benchmark_group("concrete_list_apply");
group.warm_up_time(WARM_UP_TIME);
group.measurement_time(MEASUREMENT_TIME);

let empty_base = |_: usize| || Vec::<u64>::new();
let full_base = |size: usize| move || iter::repeat(0).take(size).collect::<Vec<u64>>();
let patch = |size: usize| iter::repeat(1).take(size).collect::<Vec<u64>>();

list_apply(&mut group, "empty_base_concrete_patch", empty_base, patch);

list_apply(&mut group, "empty_base_dynamic_patch", empty_base, |size| {
patch(size).clone_dynamic()
});

list_apply(&mut group, "same_len_concrete_patch", full_base, patch);

list_apply(&mut group, "same_len_dynamic_patch", full_base, |size| {
patch(size).clone_dynamic()
});

group.finish();
}

fn concrete_list_clone_dynamic(criterion: &mut Criterion) {
let mut group = criterion.benchmark_group("concrete_list_clone_dynamic");
group.warm_up_time(WARM_UP_TIME);
group.measurement_time(MEASUREMENT_TIME);

for size in SIZES {
group.throughput(Throughput::Elements(size as u64));

group.bench_with_input(
BenchmarkId::from_parameter(size),
&size,
|bencher, &size| {
let v = iter::repeat(0).take(size).collect::<Vec<_>>();

bencher.iter(|| black_box(&v).clone_dynamic());
},
);
}

group.finish();
}

fn dynamic_list_push(criterion: &mut Criterion) {
let mut group = criterion.benchmark_group("dynamic_list_push");
group.warm_up_time(WARM_UP_TIME);
group.measurement_time(MEASUREMENT_TIME);

for size in SIZES {
group.throughput(Throughput::Elements(size as u64));

group.bench_with_input(
BenchmarkId::from_parameter(size),
&size,
|bencher, &size| {
let src = iter::repeat(()).take(size).collect::<Vec<_>>();
let dst = DynamicList::default();

bencher.iter_batched(
|| (src.clone(), dst.clone_dynamic()),
|(src, mut dst)| {
for item in src {
dst.push(item);
}
},
BatchSize::SmallInput,
);
},
);
}

group.finish();
}

fn dynamic_list_apply(criterion: &mut Criterion) {
let mut group = criterion.benchmark_group("dynamic_list_apply");
group.warm_up_time(WARM_UP_TIME);
group.measurement_time(MEASUREMENT_TIME);

let empty_base = |_: usize| || Vec::<u64>::new().clone_dynamic();
let full_base = |size: usize| move || iter::repeat(0).take(size).collect::<Vec<u64>>();
let patch = |size: usize| iter::repeat(1).take(size).collect::<Vec<u64>>();

list_apply(&mut group, "empty_base_concrete_patch", empty_base, patch);

list_apply(&mut group, "empty_base_dynamic_patch", empty_base, |size| {
patch(size).clone_dynamic()
});

list_apply(&mut group, "same_len_concrete_patch", full_base, patch);

list_apply(&mut group, "same_len_dynamic_patch", full_base, |size| {
patch(size).clone_dynamic()
});

group.finish();
}
Loading

0 comments on commit 17c5238

Please sign in to comment.