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

Migrate black box #6

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion benches/benches/bevy_ecs/change_detection.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use core::hint::black_box;

use bevy_ecs::{
component::{Component, Mutable},
entity::Entity,
prelude::{Added, Changed, EntityWorldMut, QueryState},
query::QueryFilter,
world::World,
};
use criterion::{black_box, criterion_group, Criterion};
use criterion::{criterion_group, Criterion};
use rand::{prelude::SliceRandom, SeedableRng};
use rand_chacha::ChaCha8Rng;

Expand Down
4 changes: 3 additions & 1 deletion benches/benches/bevy_ecs/empty_archetypes.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use core::hint::black_box;

use bevy_ecs::{component::Component, prelude::*, schedule::ExecutorKind, world::World};
use criterion::{black_box, criterion_group, BenchmarkId, Criterion};
use criterion::{criterion_group, BenchmarkId, Criterion};

criterion_group!(benches, empty_archetypes);

Expand Down
4 changes: 3 additions & 1 deletion benches/benches/bevy_ecs/entity_cloning.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use core::hint::black_box;

use bevy_ecs::bundle::Bundle;
use bevy_ecs::reflect::AppTypeRegistry;
use bevy_ecs::{component::Component, reflect::ReflectComponent, world::World};
use bevy_hierarchy::{BuildChildren, CloneEntityHierarchyExt};
use bevy_math::Mat4;
use bevy_reflect::{GetTypeRegistration, Reflect};
use criterion::{black_box, criterion_group, criterion_main, Bencher, Criterion};
use criterion::{criterion_group, criterion_main, Bencher, Criterion};

criterion_group!(benches, reflect_benches, clone_benches);
criterion_main!(benches);
Expand Down
4 changes: 3 additions & 1 deletion benches/benches/bevy_ecs/observers/propagation.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use core::hint::black_box;

use bevy_ecs::{
component::Component, entity::Entity, event::Event, observer::Trigger, world::World,
};
use bevy_hierarchy::{BuildChildren, Parent};

use criterion::{black_box, Criterion};
use criterion::Criterion;
use rand::SeedableRng;
use rand::{seq::IteratorRandom, Rng};
use rand_chacha::ChaCha8Rng;
Expand Down
4 changes: 3 additions & 1 deletion benches/benches/bevy_ecs/observers/simple.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use core::hint::black_box;

use bevy_ecs::{entity::Entity, event::Event, observer::Trigger, world::World};

use criterion::{black_box, Criterion};
use criterion::Criterion;
use rand::{prelude::SliceRandom, SeedableRng};
use rand_chacha::ChaCha8Rng;
fn deterministic_rand() -> ChaCha8Rng {
Expand Down
4 changes: 3 additions & 1 deletion benches/benches/bevy_ecs/world/commands.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use core::hint::black_box;

use bevy_ecs::{
component::Component,
system::Commands,
world::{Command, CommandQueue, World},
};
use criterion::{black_box, Criterion};
use criterion::Criterion;

#[derive(Component)]
struct A;
Expand Down
4 changes: 3 additions & 1 deletion benches/benches/bevy_ecs/world/world_get.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use core::hint::black_box;

use bevy_ecs::{
bundle::Bundle,
component::Component,
entity::Entity,
system::{Query, SystemState},
world::World,
};
use criterion::{black_box, Criterion};
use criterion::Criterion;
use rand::{prelude::SliceRandom, SeedableRng};
use rand_chacha::ChaCha8Rng;

Expand Down
4 changes: 3 additions & 1 deletion benches/benches/bevy_math/bezier.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use criterion::{black_box, criterion_group, Criterion};
use core::hint::black_box;

use criterion::{criterion_group, Criterion};

use bevy_math::prelude::*;

Expand Down
4 changes: 3 additions & 1 deletion benches/benches/bevy_picking/ray_mesh_intersection.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use core::hint::black_box;

use bevy_math::{Dir3, Mat4, Ray3d, Vec3};
use bevy_picking::mesh_picking::ray_cast;
use criterion::{black_box, criterion_group, Criterion};
use criterion::{criterion_group, Criterion};

fn ptoxznorm(p: u32, size: u32) -> (f32, f32) {
let ij = (p / (size), p % (size));
Expand Down
6 changes: 3 additions & 3 deletions benches/benches/bevy_reflect/list.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use core::{iter, time::Duration};
use core::{hint::black_box, iter, time::Duration};

use benches::bench;
use bevy_reflect::{DynamicList, List};
use criterion::{
black_box, criterion_group, measurement::Measurement, AxisScale, BatchSize, BenchmarkGroup,
BenchmarkId, Criterion, PlotConfiguration, Throughput,
criterion_group, measurement::Measurement, AxisScale, BatchSize, BenchmarkGroup, BenchmarkId,
Criterion, PlotConfiguration, Throughput,
};

criterion_group!(
Expand Down
6 changes: 3 additions & 3 deletions benches/benches/bevy_reflect/map.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use core::{fmt::Write, iter, time::Duration};
use core::{fmt::Write, hint::black_box, iter, time::Duration};

use benches::bench;
use bevy_reflect::{DynamicMap, Map};
use bevy_utils::HashMap;
use criterion::{
black_box, criterion_group, measurement::Measurement, AxisScale, BatchSize, BenchmarkGroup,
BenchmarkId, Criterion, PlotConfiguration, Throughput,
criterion_group, measurement::Measurement, AxisScale, BatchSize, BenchmarkGroup, BenchmarkId,
Criterion, PlotConfiguration, Throughput,
};

criterion_group!(
Expand Down
4 changes: 2 additions & 2 deletions benches/benches/bevy_reflect/path.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use core::{fmt::Write, str, time::Duration};
use core::{fmt::Write, hint::black_box, str, time::Duration};

use benches::bench;
use bevy_reflect::ParsedPath;
use criterion::{black_box, criterion_group, BatchSize, BenchmarkId, Criterion, Throughput};
use criterion::{criterion_group, BatchSize, BenchmarkId, Criterion, Throughput};
use rand::{distributions::Uniform, Rng, SeedableRng};
use rand_chacha::ChaCha8Rng;

Expand Down
6 changes: 3 additions & 3 deletions benches/benches/bevy_reflect/struct.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use core::time::Duration;
use core::{hint::black_box, time::Duration};

use benches::bench;
use bevy_reflect::{DynamicStruct, GetField, PartialReflect, Reflect, Struct};
use criterion::{
black_box, criterion_group, measurement::Measurement, AxisScale, BatchSize, BenchmarkGroup,
BenchmarkId, Criterion, PlotConfiguration, Throughput,
criterion_group, measurement::Measurement, AxisScale, BatchSize, BenchmarkGroup, BenchmarkId,
Criterion, PlotConfiguration, Throughput,
};

criterion_group!(
Expand Down
4 changes: 3 additions & 1 deletion benches/benches/bevy_render/render_layers.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use criterion::{black_box, criterion_group, Criterion};
use core::hint::black_box;

use criterion::{criterion_group, Criterion};

use bevy_render::view::RenderLayers;

Expand Down
4 changes: 3 additions & 1 deletion benches/benches/bevy_render/torus.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use criterion::{black_box, criterion_group, Criterion};
use core::hint::black_box;

use criterion::{criterion_group, Criterion};

use bevy_render::mesh::TorusMeshBuilder;

Expand Down
4 changes: 3 additions & 1 deletion benches/benches/bevy_tasks/iter.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use core::hint::black_box;

use bevy_tasks::{ParallelIterator, TaskPoolBuilder};
use criterion::{black_box, criterion_group, BenchmarkId, Criterion};
use criterion::{criterion_group, BenchmarkId, Criterion};

struct ParChunks<'a, T>(core::slice::Chunks<'a, T>);
impl<'a, T> ParallelIterator<core::slice::Iter<'a, T>> for ParChunks<'a, T>
Expand Down
1 change: 1 addition & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ disallowed-methods = [
{ path = "f32::asinh", reason = "use bevy_math::ops::asinh instead for libm determinism" },
{ path = "f32::acosh", reason = "use bevy_math::ops::acosh instead for libm determinism" },
{ path = "f32::atanh", reason = "use bevy_math::ops::atanh instead for libm determinism" },
{ path = "criterion::black_box", reason = "use core::hint::black_box instead" },
]
Loading