nalgebra/benches/quat.rs

25 lines
823 B
Rust
Raw Normal View History

2015-02-17 21:10:08 +08:00
#![feature(test)]
2014-11-07 23:15:56 +08:00
extern crate test;
2015-02-17 21:10:08 +08:00
extern crate rand;
extern crate nalgebra as na;
2014-11-07 23:15:56 +08:00
2015-02-17 21:10:08 +08:00
use rand::{IsaacRng, Rng};
2014-11-07 23:15:56 +08:00
use test::Bencher;
use na::{Quat, UnitQuat, Vec3};
2015-01-04 05:48:10 +08:00
use std::ops::{Add, Sub, Mul, Div};
2014-11-07 23:15:56 +08:00
#[path="common/macros.rs"]
mod macros;
2014-12-27 18:15:13 +08:00
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_mul_q, Quat<f32>, Quat<f32>, mul);
2014-11-07 23:15:56 +08:00
// bench_binop!(_bench_quat_div_q, Quat<f32>, Quat<f32>, div)
2014-12-27 18:15:13 +08:00
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_div_s, Quat<f32>, f32, div);
bench_unop!(_bench_quat_inv, Quat<f32>, inv);
bench_unop_self!(_bench_quat_conjugate, Quat<f32>, conjugate);
bench_unop!(_bench_quat_normalize, Quat<f32>, normalize);