-
-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into RapierContext_Component
- Loading branch information
Showing
22 changed files
with
600 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use bevy::app::App; | ||
use bevy_rapier_benches3d::common::{default_app, wait_app_start}; | ||
|
||
pub fn bench_app_updates(bencher: divan::Bencher, setup: impl Fn(&mut App)) { | ||
let mut app = default_app(); | ||
setup(&mut app); | ||
wait_app_start(&mut app); | ||
|
||
bencher.bench_local(|| { | ||
app.update(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
//! Translated from avian benchmark. | ||
//! | ||
//! <https://github.com/Jondolf/avian/blob/81290423e146264120cf9711af716f6faf669717/crates/avian3d/benches/cubes.rs> | ||
|
||
mod common; | ||
|
||
use common::bench_app_updates; | ||
|
||
use bevy::prelude::*; | ||
use bevy_rapier3d::math::*; | ||
use bevy_rapier3d::prelude::*; | ||
|
||
fn setup_cubes(app: &mut App, size: u32) { | ||
app.add_systems(Startup, move |mut commands: Commands| { | ||
commands.spawn(( | ||
RigidBody::Fixed, | ||
Transform::from_translation(-2.0 * Vect::Z), | ||
Collider::cuboid(100.0, 1.0, 100.0), | ||
)); | ||
for x in 0..size { | ||
for z in 0..size { | ||
commands.spawn(( | ||
RigidBody::Dynamic, | ||
Transform::from_translation(Vec3::new(x as f32, 2.0, z as f32)), | ||
Collider::cuboid(1.0, 1.0, 1.0), | ||
)); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
#[divan::bench(sample_count = 60, sample_size = 1)] | ||
fn cubes_3x3(bencher: divan::Bencher) { | ||
bench_app_updates(bencher, |app| setup_cubes(app, 3)) | ||
} | ||
#[divan::bench(sample_count = 60, sample_size = 1)] | ||
fn cubes_5x5(bencher: divan::Bencher) { | ||
bench_app_updates(bencher, |app| setup_cubes(app, 5)) | ||
} | ||
#[divan::bench(sample_count = 60, sample_size = 1)] | ||
fn cubes_10x10(bencher: divan::Bencher) { | ||
bench_app_updates(bencher, |app| setup_cubes(app, 10)) | ||
} | ||
#[divan::bench(sample_count = 60, sample_size = 1)] | ||
fn cubes_20x20(bencher: divan::Bencher) { | ||
bench_app_updates(bencher, |app| setup_cubes(app, 20)) | ||
} | ||
|
||
fn main() { | ||
// Run registered benchmarks. | ||
divan::main(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//! Translated from rapier benchmark. | ||
//! | ||
//! <https://github.com/dimforge/rapier/blob/87ada34008f4a1a313ccf8c3040040bab4f10e69/benchmarks3d/many_pyramids3.rs> | ||
|
||
mod common; | ||
|
||
use bevy_rapier_benches3d::pyramids::setup_pyramids; | ||
use common::bench_app_updates; | ||
|
||
#[divan::bench(sample_count = 60, sample_size = 1)] | ||
fn pyramid_1_with_height_2(bencher: divan::Bencher) { | ||
bench_app_updates(bencher, |app| setup_pyramids(app, 1, 2)); | ||
} | ||
|
||
#[divan::bench(sample_count = 60, sample_size = 1)] | ||
fn pyramid_1_with_height_20(bencher: divan::Bencher) { | ||
bench_app_updates(bencher, |app| setup_pyramids(app, 1, 20)); | ||
} | ||
|
||
#[divan::bench(sample_count = 60, sample_size = 1)] | ||
fn pyramid_2_with_height_20(bencher: divan::Bencher) { | ||
bench_app_updates(bencher, |app| setup_pyramids(app, 2, 20)); | ||
} | ||
|
||
fn main() { | ||
// Run registered benchmarks. | ||
divan::main(); | ||
} |
Oops, something went wrong.