mirror of
https://github.com/bevyengine/bevy
synced 2024-12-30 06:53:13 +00:00
Added complex function to benchmark
This commit is contained in:
parent
5923cfa0ec
commit
bd62310634
1 changed files with 159 additions and 0 deletions
|
@ -84,6 +84,20 @@ fn overload(c: &mut Criterion) {
|
|||
a + b
|
||||
}
|
||||
|
||||
fn complex<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
|
||||
_: T0,
|
||||
_: T1,
|
||||
_: T2,
|
||||
_: T3,
|
||||
_: T4,
|
||||
_: T5,
|
||||
_: T6,
|
||||
_: T7,
|
||||
_: T8,
|
||||
_: T9,
|
||||
) {
|
||||
}
|
||||
|
||||
c.benchmark_group("with_overload")
|
||||
.bench_function("01_overload", |b| {
|
||||
b.iter_batched(
|
||||
|
@ -92,6 +106,15 @@ fn overload(c: &mut Criterion) {
|
|||
BatchSize::SmallInput,
|
||||
);
|
||||
})
|
||||
.bench_function("01_complex_overload", |b| {
|
||||
b.iter_batched(
|
||||
|| complex::<i8, i16, i32, i64, i128, u8, u16, u32, u64, u128>.into_function(),
|
||||
|func| {
|
||||
func.with_overload(complex::<i16, i32, i64, i128, u8, u16, u32, u64, u128, i8>)
|
||||
},
|
||||
BatchSize::SmallInput,
|
||||
);
|
||||
})
|
||||
.bench_function("03_overload", |b| {
|
||||
b.iter_batched(
|
||||
|| add::<i8>.into_function(),
|
||||
|
@ -103,6 +126,17 @@ fn overload(c: &mut Criterion) {
|
|||
BatchSize::SmallInput,
|
||||
);
|
||||
})
|
||||
.bench_function("03_complex_overload", |b| {
|
||||
b.iter_batched(
|
||||
|| complex::<i8, i16, i32, i64, i128, u8, u16, u32, u64, u128>.into_function(),
|
||||
|func| {
|
||||
func.with_overload(complex::<i16, i32, i64, i128, u8, u16, u32, u64, u128, i8>)
|
||||
.with_overload(complex::<i32, i64, i128, u8, u16, u32, u64, u128, i8, i16>)
|
||||
.with_overload(complex::<i64, i128, u8, u16, u32, u64, u128, i8, i16, i32>)
|
||||
},
|
||||
BatchSize::SmallInput,
|
||||
);
|
||||
})
|
||||
.bench_function("10_overload", |b| {
|
||||
b.iter_batched(
|
||||
|| add::<i8>.into_function(),
|
||||
|
@ -120,6 +154,23 @@ fn overload(c: &mut Criterion) {
|
|||
BatchSize::SmallInput,
|
||||
);
|
||||
})
|
||||
.bench_function("10_complex_overload", |b| {
|
||||
b.iter_batched(
|
||||
|| complex::<i8, i16, i32, i64, i128, u8, u16, u32, u64, u128>.into_function(),
|
||||
|func| {
|
||||
func.with_overload(complex::<i16, i32, i64, i128, u8, u16, u32, u64, u128, i8>)
|
||||
.with_overload(complex::<i32, i64, i128, u8, u16, u32, u64, u128, i8, i16>)
|
||||
.with_overload(complex::<i64, i128, u8, u16, u32, u64, u128, i8, i16, i32>)
|
||||
.with_overload(complex::<i128, u8, u16, u32, u64, u128, i8, i16, i32, i64>)
|
||||
.with_overload(complex::<u8, u16, u32, u64, u128, i8, i16, i32, i64, i128>)
|
||||
.with_overload(complex::<u16, u32, u64, u128, i8, i16, i32, i64, i128, u8>)
|
||||
.with_overload(complex::<u32, u64, u128, i8, i16, i32, i64, i128, u8, u16>)
|
||||
.with_overload(complex::<u64, u128, i8, i16, i32, i64, i128, u8, u16, u32>)
|
||||
.with_overload(complex::<u128, i8, i16, i32, i64, i128, u8, u16, u32, u64>)
|
||||
},
|
||||
BatchSize::SmallInput,
|
||||
);
|
||||
})
|
||||
.bench_function("01_nested_overload", |b| {
|
||||
b.iter_batched(
|
||||
|| add::<i8>.into_function(),
|
||||
|
@ -181,6 +232,32 @@ fn overload(c: &mut Criterion) {
|
|||
BatchSize::SmallInput,
|
||||
);
|
||||
})
|
||||
.bench_function("01_complex_overload", |b| {
|
||||
b.iter_batched(
|
||||
|| {
|
||||
(
|
||||
complex::<i8, i16, i32, i64, i128, u8, u16, u32, u64, u128>
|
||||
.into_function()
|
||||
.with_overload(
|
||||
complex::<i16, i32, i64, i128, u8, u16, u32, u64, u128, i8>,
|
||||
),
|
||||
ArgList::new()
|
||||
.push_owned(1_i8)
|
||||
.push_owned(2_i16)
|
||||
.push_owned(3_i32)
|
||||
.push_owned(4_i64)
|
||||
.push_owned(5_i128)
|
||||
.push_owned(6_u8)
|
||||
.push_owned(7_u16)
|
||||
.push_owned(8_u32)
|
||||
.push_owned(9_u64)
|
||||
.push_owned(10_u128),
|
||||
)
|
||||
},
|
||||
|(func, args)| func.call(args),
|
||||
BatchSize::SmallInput,
|
||||
);
|
||||
})
|
||||
.bench_function("03_overload", |b| {
|
||||
b.iter_batched(
|
||||
|| {
|
||||
|
@ -197,6 +274,38 @@ fn overload(c: &mut Criterion) {
|
|||
BatchSize::SmallInput,
|
||||
);
|
||||
})
|
||||
.bench_function("03_complex_overload", |b| {
|
||||
b.iter_batched(
|
||||
|| {
|
||||
(
|
||||
complex::<i8, i16, i32, i64, i128, u8, u16, u32, u64, u128>
|
||||
.into_function()
|
||||
.with_overload(
|
||||
complex::<i16, i32, i64, i128, u8, u16, u32, u64, u128, i8>,
|
||||
)
|
||||
.with_overload(
|
||||
complex::<i32, i64, i128, u8, u16, u32, u64, u128, i8, i16>,
|
||||
)
|
||||
.with_overload(
|
||||
complex::<i64, i128, u8, u16, u32, u64, u128, i8, i16, i32>,
|
||||
),
|
||||
ArgList::new()
|
||||
.push_owned(1_i32)
|
||||
.push_owned(2_i64)
|
||||
.push_owned(3_i128)
|
||||
.push_owned(4_u8)
|
||||
.push_owned(5_u16)
|
||||
.push_owned(6_u32)
|
||||
.push_owned(7_u64)
|
||||
.push_owned(8_u128)
|
||||
.push_owned(9_i8)
|
||||
.push_owned(10_i16),
|
||||
)
|
||||
},
|
||||
|(func, args)| func.call(args),
|
||||
BatchSize::SmallInput,
|
||||
);
|
||||
})
|
||||
.bench_function("10_overload", |b| {
|
||||
b.iter_batched(
|
||||
|| {
|
||||
|
@ -218,6 +327,56 @@ fn overload(c: &mut Criterion) {
|
|||
|(func, args)| func.call(args),
|
||||
BatchSize::SmallInput,
|
||||
);
|
||||
})
|
||||
.bench_function("10_complex_overload", |b| {
|
||||
b.iter_batched(
|
||||
|| {
|
||||
(
|
||||
complex::<i8, i16, i32, i64, i128, u8, u16, u32, u64, u128>
|
||||
.into_function()
|
||||
.with_overload(
|
||||
complex::<i16, i32, i64, i128, u8, u16, u32, u64, u128, i8>,
|
||||
)
|
||||
.with_overload(
|
||||
complex::<i32, i64, i128, u8, u16, u32, u64, u128, i8, i16>,
|
||||
)
|
||||
.with_overload(
|
||||
complex::<i64, i128, u8, u16, u32, u64, u128, i8, i16, i32>,
|
||||
)
|
||||
.with_overload(
|
||||
complex::<i128, u8, u16, u32, u64, u128, i8, i16, i32, i64>,
|
||||
)
|
||||
.with_overload(
|
||||
complex::<u8, u16, u32, u64, u128, i8, i16, i32, i64, i128>,
|
||||
)
|
||||
.with_overload(
|
||||
complex::<u16, u32, u64, u128, i8, i16, i32, i64, i128, u8>,
|
||||
)
|
||||
.with_overload(
|
||||
complex::<u32, u64, u128, i8, i16, i32, i64, i128, u8, u16>,
|
||||
)
|
||||
.with_overload(
|
||||
complex::<u64, u128, i8, i16, i32, i64, i128, u8, u16, u32>,
|
||||
)
|
||||
.with_overload(
|
||||
complex::<u128, i8, i16, i32, i64, i128, u8, u16, u32, u64>,
|
||||
),
|
||||
ArgList::new()
|
||||
.push_owned(1_u8)
|
||||
.push_owned(2_u16)
|
||||
.push_owned(3_u32)
|
||||
.push_owned(4_u64)
|
||||
.push_owned(5_u128)
|
||||
.push_owned(6_i8)
|
||||
.push_owned(7_i16)
|
||||
.push_owned(8_i32)
|
||||
.push_owned(9_i64)
|
||||
.push_owned(10_i128),
|
||||
)
|
||||
},
|
||||
|(func, args)| func.call(args),
|
||||
BatchSize::SmallInput,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue