Fix benches.

This commit is contained in:
Sébastien Crozet 2014-12-27 11:15:13 +01:00
parent ec44d197b2
commit 73c49884c3
6 changed files with 89 additions and 89 deletions

View File

@ -21,7 +21,7 @@ macro_rules! bench_binop(
}) })
} }
} }
) );
macro_rules! bench_binop_na( macro_rules! bench_binop_na(
($name: ident, $t1: ty, $t2: ty, $binop: ident) => { ($name: ident, $t1: ty, $t2: ty, $binop: ident) => {
@ -44,7 +44,7 @@ macro_rules! bench_binop_na(
}) })
} }
} }
) );
macro_rules! bench_unop( macro_rules! bench_unop(
($name: ident, $t: ty, $unop: ident) => { ($name: ident, $t: ty, $unop: ident) => {
@ -66,7 +66,7 @@ macro_rules! bench_unop(
}) })
} }
} }
) );
macro_rules! bench_unop_self( macro_rules! bench_unop_self(
($name: ident, $t: ty, $unop: ident) => { ($name: ident, $t: ty, $unop: ident) => {
@ -88,7 +88,7 @@ macro_rules! bench_unop_self(
}) })
} }
} }
) );
macro_rules! bench_construction( macro_rules! bench_construction(
($name: ident, $constructor: path $(, $args: ident: $types: ty)*) => { ($name: ident, $constructor: path $(, $args: ident: $types: ty)*) => {
@ -111,4 +111,4 @@ macro_rules! bench_construction(
}) })
} }
} }
) );

View File

@ -10,9 +10,9 @@ use na::{UnitQuat, Rot2, Rot3, Vec1, Vec3};
#[path="common/macros.rs"] #[path="common/macros.rs"]
mod macros; mod macros;
bench_construction!(_bench_quat_from_axisangle, UnitQuat::new, axisangle: Vec3<f32>) bench_construction!(_bench_quat_from_axisangle, UnitQuat::new, axisangle: Vec3<f32>);
bench_construction!(_bench_rot2_from_axisangle, Rot2::new, axisangle: Vec1<f32>) bench_construction!(_bench_rot2_from_axisangle, Rot2::new, axisangle: Vec1<f32>);
bench_construction!(_bench_rot3_from_axisangle, Rot3::new, axisangle: Vec3<f32>) bench_construction!(_bench_rot3_from_axisangle, Rot3::new, axisangle: Vec3<f32>);
bench_construction!(_bench_quat_from_euler_angles, UnitQuat::new_with_euler_angles, roll: f32, pitch: f32, yaw: f32) bench_construction!(_bench_quat_from_euler_angles, UnitQuat::new_with_euler_angles, roll: f32, pitch: f32, yaw: f32);
bench_construction!(_bench_rot3_from_euler_angles, Rot3::new_with_euler_angles, roll: f32, pitch: f32, yaw: f32) bench_construction!(_bench_rot3_from_euler_angles, Rot3::new_with_euler_angles, roll: f32, pitch: f32, yaw: f32);

View File

@ -20,31 +20,31 @@ macro_rules! bench_mul_dmat(
}) })
} }
} }
) );
#[bench] #[bench]
fn bench_mul_dmat2(bh: &mut Bencher) { fn bench_mul_dmat2(bh: &mut Bencher) {
bench_mul_dmat!(bh, 2, 2) bench_mul_dmat!(bh, 2, 2);
} }
#[bench] #[bench]
fn bench_mul_dmat3(bh: &mut Bencher) { fn bench_mul_dmat3(bh: &mut Bencher) {
bench_mul_dmat!(bh, 3, 3) bench_mul_dmat!(bh, 3, 3);
} }
#[bench] #[bench]
fn bench_mul_dmat4(bh: &mut Bencher) { fn bench_mul_dmat4(bh: &mut Bencher) {
bench_mul_dmat!(bh, 4, 4) bench_mul_dmat!(bh, 4, 4);
} }
#[bench] #[bench]
fn bench_mul_dmat5(bh: &mut Bencher) { fn bench_mul_dmat5(bh: &mut Bencher) {
bench_mul_dmat!(bh, 5, 5) bench_mul_dmat!(bh, 5, 5);
} }
#[bench] #[bench]
fn bench_mul_dmat6(bh: &mut Bencher) { fn bench_mul_dmat6(bh: &mut Bencher) {
bench_mul_dmat!(bh, 6, 6) bench_mul_dmat!(bh, 6, 6);
} }
macro_rules! bench_mul_dmat_dvec( macro_rules! bench_mul_dmat_dvec(
@ -62,29 +62,29 @@ macro_rules! bench_mul_dmat_dvec(
}) })
} }
} }
) );
#[bench] #[bench]
fn bench_mul_dmat_dvec2(bh: &mut Bencher) { fn bench_mul_dmat_dvec2(bh: &mut Bencher) {
bench_mul_dmat_dvec!(bh, 2, 2) bench_mul_dmat_dvec!(bh, 2, 2);
} }
#[bench] #[bench]
fn bench_mul_dmat_dvec3(bh: &mut Bencher) { fn bench_mul_dmat_dvec3(bh: &mut Bencher) {
bench_mul_dmat_dvec!(bh, 3, 3) bench_mul_dmat_dvec!(bh, 3, 3);
} }
#[bench] #[bench]
fn bench_mul_dmat_dvec4(bh: &mut Bencher) { fn bench_mul_dmat_dvec4(bh: &mut Bencher) {
bench_mul_dmat_dvec!(bh, 4, 4) bench_mul_dmat_dvec!(bh, 4, 4);
} }
#[bench] #[bench]
fn bench_mul_dmat_dvec5(bh: &mut Bencher) { fn bench_mul_dmat_dvec5(bh: &mut Bencher) {
bench_mul_dmat_dvec!(bh, 5, 5) bench_mul_dmat_dvec!(bh, 5, 5);
} }
#[bench] #[bench]
fn bench_mul_dmat_dvec6(bh: &mut Bencher) { fn bench_mul_dmat_dvec6(bh: &mut Bencher) {
bench_mul_dmat_dvec!(bh, 6, 6) bench_mul_dmat_dvec!(bh, 6, 6);
} }

View File

@ -10,34 +10,34 @@ use na::{Vec2, Vec3, Vec4, Mat2, Mat3, Mat4};
#[path="common/macros.rs"] #[path="common/macros.rs"]
mod macros; mod macros;
bench_binop!(_bench_mat2_mul_m, Mat2<f32>, Mat2<f32>, mul) bench_binop!(_bench_mat2_mul_m, Mat2<f32>, Mat2<f32>, mul);
bench_binop!(_bench_mat3_mul_m, Mat3<f32>, Mat3<f32>, mul) bench_binop!(_bench_mat3_mul_m, Mat3<f32>, Mat3<f32>, mul);
bench_binop!(_bench_mat4_mul_m, Mat4<f32>, Mat4<f32>, mul) bench_binop!(_bench_mat4_mul_m, Mat4<f32>, Mat4<f32>, mul);
bench_binop!(_bench_mat2_add_m, Mat2<f32>, Mat2<f32>, add) bench_binop!(_bench_mat2_add_m, Mat2<f32>, Mat2<f32>, add);
bench_binop!(_bench_mat3_add_m, Mat3<f32>, Mat3<f32>, add) bench_binop!(_bench_mat3_add_m, Mat3<f32>, Mat3<f32>, add);
bench_binop!(_bench_mat4_add_m, Mat4<f32>, Mat4<f32>, add) bench_binop!(_bench_mat4_add_m, Mat4<f32>, Mat4<f32>, add);
bench_binop!(_bench_mat2_sub_m, Mat2<f32>, Mat2<f32>, sub) bench_binop!(_bench_mat2_sub_m, Mat2<f32>, Mat2<f32>, sub);
bench_binop!(_bench_mat3_sub_m, Mat3<f32>, Mat3<f32>, sub) bench_binop!(_bench_mat3_sub_m, Mat3<f32>, Mat3<f32>, sub);
bench_binop!(_bench_mat4_sub_m, Mat4<f32>, Mat4<f32>, sub) bench_binop!(_bench_mat4_sub_m, Mat4<f32>, Mat4<f32>, sub);
bench_binop!(_bench_mat2_mul_v, Mat2<f32>, Vec2<f32>, mul) bench_binop!(_bench_mat2_mul_v, Mat2<f32>, Vec2<f32>, mul);
bench_binop!(_bench_mat3_mul_v, Mat3<f32>, Vec3<f32>, mul) bench_binop!(_bench_mat3_mul_v, Mat3<f32>, Vec3<f32>, mul);
bench_binop!(_bench_mat4_mul_v, Mat4<f32>, Vec4<f32>, mul) bench_binop!(_bench_mat4_mul_v, Mat4<f32>, Vec4<f32>, mul);
bench_binop!(_bench_mat2_mul_s, Mat2<f32>, f32, mul) bench_binop!(_bench_mat2_mul_s, Mat2<f32>, f32, mul);
bench_binop!(_bench_mat3_mul_s, Mat3<f32>, f32, mul) bench_binop!(_bench_mat3_mul_s, Mat3<f32>, f32, mul);
bench_binop!(_bench_mat4_mul_s, Mat4<f32>, f32, mul) bench_binop!(_bench_mat4_mul_s, Mat4<f32>, f32, mul);
bench_binop!(_bench_mat2_div_s, Mat2<f32>, f32, div) bench_binop!(_bench_mat2_div_s, Mat2<f32>, f32, div);
bench_binop!(_bench_mat3_div_s, Mat3<f32>, f32, div) bench_binop!(_bench_mat3_div_s, Mat3<f32>, f32, div);
bench_binop!(_bench_mat4_div_s, Mat4<f32>, f32, div) bench_binop!(_bench_mat4_div_s, Mat4<f32>, f32, div);
bench_unop!(_bench_mat2_inv, Mat2<f32>, inv) bench_unop!(_bench_mat2_inv, Mat2<f32>, inv);
bench_unop!(_bench_mat3_inv, Mat3<f32>, inv) bench_unop!(_bench_mat3_inv, Mat3<f32>, inv);
bench_unop!(_bench_mat4_inv, Mat4<f32>, inv) bench_unop!(_bench_mat4_inv, Mat4<f32>, inv);
bench_unop!(_bench_mat2_transpose, Mat2<f32>, transpose) bench_unop!(_bench_mat2_transpose, Mat2<f32>, transpose);
bench_unop!(_bench_mat3_transpose, Mat3<f32>, transpose) bench_unop!(_bench_mat3_transpose, Mat3<f32>, transpose);
bench_unop!(_bench_mat4_transpose, Mat4<f32>, transpose) bench_unop!(_bench_mat4_transpose, Mat4<f32>, transpose);

View File

@ -10,13 +10,13 @@ use na::{Quat, UnitQuat, Vec3};
#[path="common/macros.rs"] #[path="common/macros.rs"]
mod macros; mod macros;
bench_binop!(_bench_quat_add_q, Quat<f32>, Quat<f32>, add) bench_binop!(_bench_quat_add_q, Quat<f32>, Quat<f32>, add);
bench_binop!(_bench_quat_sub_q, Quat<f32>, Quat<f32>, sub) bench_binop!(_bench_quat_sub_q, Quat<f32>, Quat<f32>, sub);
bench_binop!(_bench_quat_mul_q, Quat<f32>, Quat<f32>, mul) bench_binop!(_bench_quat_mul_q, Quat<f32>, Quat<f32>, mul);
// bench_binop!(_bench_quat_div_q, Quat<f32>, Quat<f32>, div) // bench_binop!(_bench_quat_div_q, Quat<f32>, Quat<f32>, div)
bench_binop!(_bench_quat_mul_v, UnitQuat<f32>, Vec3<f32>, mul) bench_binop!(_bench_quat_mul_v, UnitQuat<f32>, Vec3<f32>, mul);
bench_binop!(_bench_quat_mul_s, Quat<f32>, f32, mul) bench_binop!(_bench_quat_mul_s, Quat<f32>, f32, mul);
bench_binop!(_bench_quat_div_s, Quat<f32>, f32, div) bench_binop!(_bench_quat_div_s, Quat<f32>, f32, div);
bench_unop!(_bench_quat_inv, Quat<f32>, inv) bench_unop!(_bench_quat_inv, Quat<f32>, inv);
bench_unop_self!(_bench_quat_conjugate, Quat<f32>, conjugate) bench_unop_self!(_bench_quat_conjugate, Quat<f32>, conjugate);
bench_unop!(_bench_quat_normalize, Quat<f32>, normalize) bench_unop!(_bench_quat_normalize, Quat<f32>, normalize);

View File

@ -10,48 +10,48 @@ use na::{Vec2, Vec3, Vec4};
#[path="common/macros.rs"] #[path="common/macros.rs"]
mod macros; mod macros;
bench_binop!(_bench_vec2_add_v, Vec2<f32>, Vec2<f32>, add) bench_binop!(_bench_vec2_add_v, Vec2<f32>, Vec2<f32>, add);
bench_binop!(_bench_vec3_add_v, Vec3<f32>, Vec3<f32>, add) bench_binop!(_bench_vec3_add_v, Vec3<f32>, Vec3<f32>, add);
bench_binop!(_bench_vec4_add_v, Vec4<f32>, Vec4<f32>, add) bench_binop!(_bench_vec4_add_v, Vec4<f32>, Vec4<f32>, add);
bench_binop!(_bench_vec2_sub_v, Vec2<f32>, Vec2<f32>, sub) bench_binop!(_bench_vec2_sub_v, Vec2<f32>, Vec2<f32>, sub);
bench_binop!(_bench_vec3_sub_v, Vec3<f32>, Vec3<f32>, sub) bench_binop!(_bench_vec3_sub_v, Vec3<f32>, Vec3<f32>, sub);
bench_binop!(_bench_vec4_sub_v, Vec4<f32>, Vec4<f32>, sub) bench_binop!(_bench_vec4_sub_v, Vec4<f32>, Vec4<f32>, sub);
bench_binop!(_bench_vec2_mul_v, Vec2<f32>, Vec2<f32>, mul) bench_binop!(_bench_vec2_mul_v, Vec2<f32>, Vec2<f32>, mul);
bench_binop!(_bench_vec3_mul_v, Vec3<f32>, Vec3<f32>, mul) bench_binop!(_bench_vec3_mul_v, Vec3<f32>, Vec3<f32>, mul);
bench_binop!(_bench_vec4_mul_v, Vec4<f32>, Vec4<f32>, mul) bench_binop!(_bench_vec4_mul_v, Vec4<f32>, Vec4<f32>, mul);
bench_binop!(_bench_vec2_div_v, Vec2<f32>, Vec2<f32>, div) bench_binop!(_bench_vec2_div_v, Vec2<f32>, Vec2<f32>, div);
bench_binop!(_bench_vec3_div_v, Vec3<f32>, Vec3<f32>, div) bench_binop!(_bench_vec3_div_v, Vec3<f32>, Vec3<f32>, div);
bench_binop!(_bench_vec4_div_v, Vec4<f32>, Vec4<f32>, div) bench_binop!(_bench_vec4_div_v, Vec4<f32>, Vec4<f32>, div);
bench_binop!(_bench_vec2_add_s, Vec2<f32>, f32, add) bench_binop!(_bench_vec2_add_s, Vec2<f32>, f32, add);
bench_binop!(_bench_vec3_add_s, Vec3<f32>, f32, add) bench_binop!(_bench_vec3_add_s, Vec3<f32>, f32, add);
bench_binop!(_bench_vec4_add_s, Vec4<f32>, f32, add) bench_binop!(_bench_vec4_add_s, Vec4<f32>, f32, add);
bench_binop!(_bench_vec2_sub_s, Vec2<f32>, f32, sub) bench_binop!(_bench_vec2_sub_s, Vec2<f32>, f32, sub);
bench_binop!(_bench_vec3_sub_s, Vec3<f32>, f32, sub) bench_binop!(_bench_vec3_sub_s, Vec3<f32>, f32, sub);
bench_binop!(_bench_vec4_sub_s, Vec4<f32>, f32, sub) bench_binop!(_bench_vec4_sub_s, Vec4<f32>, f32, sub);
bench_binop!(_bench_vec2_mul_s, Vec2<f32>, f32, mul) bench_binop!(_bench_vec2_mul_s, Vec2<f32>, f32, mul);
bench_binop!(_bench_vec3_mul_s, Vec3<f32>, f32, mul) bench_binop!(_bench_vec3_mul_s, Vec3<f32>, f32, mul);
bench_binop!(_bench_vec4_mul_s, Vec4<f32>, f32, mul) bench_binop!(_bench_vec4_mul_s, Vec4<f32>, f32, mul);
bench_binop!(_bench_vec2_div_s, Vec2<f32>, f32, div) bench_binop!(_bench_vec2_div_s, Vec2<f32>, f32, div);
bench_binop!(_bench_vec3_div_s, Vec3<f32>, f32, div) bench_binop!(_bench_vec3_div_s, Vec3<f32>, f32, div);
bench_binop!(_bench_vec4_div_s, Vec4<f32>, f32, div) bench_binop!(_bench_vec4_div_s, Vec4<f32>, f32, div);
bench_binop_na!(_bench_vec2_dot, Vec2<f32>, Vec2<f32>, dot) bench_binop_na!(_bench_vec2_dot, Vec2<f32>, Vec2<f32>, dot);
bench_binop_na!(_bench_vec3_dot, Vec3<f32>, Vec3<f32>, dot) bench_binop_na!(_bench_vec3_dot, Vec3<f32>, Vec3<f32>, dot);
bench_binop_na!(_bench_vec4_dot, Vec4<f32>, Vec4<f32>, dot) bench_binop_na!(_bench_vec4_dot, Vec4<f32>, Vec4<f32>, dot);
bench_binop_na!(_bench_vec3_cross, Vec3<f32>, Vec3<f32>, cross) bench_binop_na!(_bench_vec3_cross, Vec3<f32>, Vec3<f32>, cross);
bench_unop!(_bench_vec2_norm, Vec2<f32>, norm) bench_unop!(_bench_vec2_norm, Vec2<f32>, norm);
bench_unop!(_bench_vec3_norm, Vec3<f32>, norm) bench_unop!(_bench_vec3_norm, Vec3<f32>, norm);
bench_unop!(_bench_vec4_norm, Vec4<f32>, norm) bench_unop!(_bench_vec4_norm, Vec4<f32>, norm);
bench_unop!(_bench_vec2_normalize, Vec2<f32>, normalize) bench_unop!(_bench_vec2_normalize, Vec2<f32>, normalize);
bench_unop!(_bench_vec3_normalize, Vec3<f32>, normalize) bench_unop!(_bench_vec3_normalize, Vec3<f32>, normalize);
bench_unop!(_bench_vec4_normalize, Vec4<f32>, normalize) bench_unop!(_bench_vec4_normalize, Vec4<f32>, normalize);