Skip to content

Commit

Permalink
Merge branch 'main' into math-benches
Browse files Browse the repository at this point in the history
  • Loading branch information
alice-i-cecile authored Dec 29, 2024
2 parents 2f1095b + 8c34f00 commit 1dc2eec
Show file tree
Hide file tree
Showing 55 changed files with 419 additions and 281 deletions.
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
3 changes: 2 additions & 1 deletion benches/benches/bevy_math/bezier.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use benches::bench;
use bevy_math::{prelude::*, VectorSpace};
use criterion::{
black_box, criterion_group, measurement::Measurement, BatchSize, BenchmarkGroup, BenchmarkId,
criterion_group, measurement::Measurement, BatchSize, BenchmarkGroup, BenchmarkId,
Criterion,
};
use core::hint::black_box;

criterion_group!(benches, segment_ease, curve_position, curve_iter_positions);

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
8 changes: 5 additions & 3 deletions 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 Expand Up @@ -61,7 +63,7 @@ fn bench_for_each(c: &mut Criterion) {
b.iter(|| {
v.iter_mut().for_each(|x| {
busy_work(10000);
*x *= *x;
*x = x.wrapping_mul(*x);
});
});
});
Expand All @@ -77,7 +79,7 @@ fn bench_for_each(c: &mut Criterion) {
b.iter(|| {
ParChunksMut(v.chunks_mut(100)).for_each(&pool, |x| {
busy_work(10000);
*x *= *x;
*x = x.wrapping_mul(*x);
});
});
},
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" },
]
6 changes: 3 additions & 3 deletions crates/bevy_asset/src/io/file/file_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ pub struct FileWatcher {

impl FileWatcher {
pub fn new(
root: PathBuf,
path: PathBuf,
sender: Sender<AssetSourceEvent>,
debounce_wait_time: Duration,
) -> Result<Self, notify::Error> {
let root = normalize_path(super::get_base_path().join(root).as_path());
let root = normalize_path(&path);
let watcher = new_asset_event_debouncer(
root.clone(),
path.clone(),
debounce_wait_time,
FileEventHandler {
root,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub use futures_lite::AsyncWriteExt;
pub use source::*;

use alloc::sync::Arc;
use bevy_utils::{BoxedFuture, ConditionalSendFuture};
use bevy_tasks::{BoxedFuture, ConditionalSendFuture};
use core::future::Future;
use core::{
mem::size_of,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/io/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ impl AssetSource {
not(target_os = "android")
))]
{
let path = std::path::PathBuf::from(path.clone());
let path = super::file::get_base_path().join(path.clone());
if path.exists() {
Some(Box::new(
super::file::FileWatcher::new(
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_asset/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use crate::{
};
use atomicow::CowArc;
use bevy_ecs::world::World;
use bevy_utils::{BoxedFuture, ConditionalSendFuture, HashMap, HashSet};
use bevy_tasks::{BoxedFuture, ConditionalSendFuture};
use bevy_utils::{HashMap, HashSet};
use core::any::{Any, TypeId};
use downcast_rs::{impl_downcast, Downcast};
use ron::error::SpannedError;
Expand Down
9 changes: 4 additions & 5 deletions crates/bevy_asset/src/processor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,15 @@ use crate::{
};
use alloc::{collections::VecDeque, sync::Arc};
use bevy_ecs::prelude::*;
#[cfg(feature = "trace")]
use bevy_tasks::ConditionalSendFuture;
use bevy_tasks::IoTaskPool;
#[cfg(feature = "trace")]
use bevy_utils::tracing::{info_span, instrument::Instrument};
use bevy_utils::{
tracing::{debug, error, trace, warn},
HashMap, HashSet,
};
#[cfg(feature = "trace")]
use bevy_utils::{
tracing::{info_span, instrument::Instrument},
ConditionalSendFuture,
};
use futures_io::ErrorKind;
use futures_lite::{AsyncReadExt, AsyncWriteExt, StreamExt};
use parking_lot::RwLock;
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/processor/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
AssetLoadError, AssetLoader, AssetPath, DeserializeMetaError, ErasedLoadedAsset,
MissingAssetLoaderForExtensionError, MissingAssetLoaderForTypeNameError,
};
use bevy_utils::{BoxedFuture, ConditionalSendFuture};
use bevy_tasks::{BoxedFuture, ConditionalSendFuture};
use core::marker::PhantomData;
use serde::{Deserialize, Serialize};
use thiserror::Error;
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_asset/src/saver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ use crate::{
ErasedLoadedAsset, Handle, LabeledAsset, UntypedHandle,
};
use atomicow::CowArc;
use bevy_utils::{BoxedFuture, ConditionalSendFuture, HashMap};
use bevy_tasks::{BoxedFuture, ConditionalSendFuture};
use bevy_utils::HashMap;
use core::{borrow::Borrow, hash::Hash, ops::Deref};
use serde::{Deserialize, Serialize};

Expand Down
9 changes: 4 additions & 5 deletions crates/bevy_asset/src/server/loaders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ use crate::{
};
use alloc::sync::Arc;
use async_broadcast::RecvError;
#[cfg(feature = "trace")]
use bevy_tasks::ConditionalSendFuture;
use bevy_tasks::IoTaskPool;
use bevy_utils::{tracing::warn, HashMap, TypeIdMap};
#[cfg(feature = "trace")]
use bevy_utils::{
tracing::{info_span, instrument::Instrument},
ConditionalSendFuture,
};
use bevy_utils::tracing::{info_span, instrument::Instrument};
use bevy_utils::{tracing::warn, HashMap, TypeIdMap};
use core::any::TypeId;
use thiserror::Error;

Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_asset/src/transformer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{meta::Settings, Asset, ErasedLoadedAsset, Handle, LabeledAsset, UntypedHandle};
use atomicow::CowArc;
use bevy_utils::{ConditionalSendFuture, HashMap};
use bevy_tasks::ConditionalSendFuture;
use bevy_utils::HashMap;
use core::{
borrow::Borrow,
convert::Infallible,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_color/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ homepage = "https://bevyengine.org"
repository = "https://github.com/bevyengine/bevy"
license = "MIT OR Apache-2.0"
keywords = ["bevy", "color"]
rust-version = "1.82.0"
rust-version = "1.83.0"

[dependencies]
bevy_math = { path = "../bevy_math", version = "0.15.0-dev", default-features = false, features = [
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_color/src/color_gradient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ where
mod tests {
use super::*;
use crate::{palettes::basic, Srgba};
use bevy_math::curve::{Curve, CurveExt};

#[test]
fn test_color_curve() {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/post_process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub struct ChromaticAberration {
/// The size of the streaks around the edges of objects, as a fraction of
/// the window size.
///
/// The default value is 0.2.
/// The default value is 0.02.
pub intensity: f32,

/// A cap on the number of texture samples that will be performed.
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repository = "https://github.com/bevyengine/bevy"
license = "MIT OR Apache-2.0"
keywords = ["ecs", "game", "bevy"]
categories = ["game-engines", "data-structures"]
rust-version = "1.81.0"
rust-version = "1.83.0"

[features]
default = ["std", "bevy_reflect", "async_executor"]
Expand Down Expand Up @@ -84,7 +84,7 @@ critical-section = [
]

## `portable-atomic` provides additional platform support for atomic types and
## operations, even on targets without native support.
## operations, even on targets without native support.
portable-atomic = [
"dep:portable-atomic",
"dep:portable-atomic-util",
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/src/entity/clone_entities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ impl<'a, 'b> ComponentCloneCtx<'a, 'b> {
if self.target_component_written {
panic!("Trying to write component '{short_name}' multiple times")
}
if !self
if self
.component_info
.type_id()
.is_some_and(|id| id == TypeId::of::<T>())
.is_none_or(|id| id != TypeId::of::<T>())
{
panic!("TypeId of component '{short_name}' does not match source component TypeId")
};
Expand Down
5 changes: 4 additions & 1 deletion crates/bevy_gizmos/src/curves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
//! [`GizmoBuffer::curve_3d`] and assorted support items.
use bevy_color::Color;
use bevy_math::{curve::Curve, Vec2, Vec3};
use bevy_math::{
curve::{Curve, CurveExt},
Vec2, Vec3,
};

use crate::{gizmos::GizmoBuffer, prelude::GizmoConfigGroup};

Expand Down
Loading

0 comments on commit 1dc2eec

Please sign in to comment.