nalgebra/benches/quat.rs

25 lines
989 B
Rust
Raw Permalink 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::{Quaternion, UnitQuaternion, Vector3};
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;
bench_binop!(_bench_quaternion_add_q, Quaternion<f32>, Quaternion<f32>, add);
bench_binop!(_bench_quaternion_sub_q, Quaternion<f32>, Quaternion<f32>, sub);
bench_binop!(_bench_quaternion_mul_q, Quaternion<f32>, Quaternion<f32>, mul);
// bench_binop!(_bench_quaternion_div_q, Quaternion<f32>, Quaternion<f32>, div)
bench_binop!(_bench_quaternion_mul_v, UnitQuaternion<f32>, Vector3<f32>, mul);
bench_binop!(_bench_quaternion_mul_s, Quaternion<f32>, f32, mul);
bench_binop!(_bench_quaternion_div_s, Quaternion<f32>, f32, div);
bench_unop!(_bench_quaternion_inv, Quaternion<f32>, inverse);
bench_unop_self!(_bench_quaternion_conjugate, Quaternion<f32>, conjugate);
bench_unop!(_bench_quaternion_normalize, Quaternion<f32>, normalize);