Skip to content

Commit

Permalink
Merge branch 'master' into yolo_align
Browse files Browse the repository at this point in the history
  • Loading branch information
bitshifter committed Jun 20, 2019
2 parents e56e955 + 02dcac5 commit de5738e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
9 changes: 8 additions & 1 deletion benches/support/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![allow(dead_code)]
use glam::f32::{Mat2, Mat3, Mat4, Quat, Vec2, Vec3};
use glam::f32::{Mat2, Mat3, Mat4, Quat, Vec2, Vec3, Vec4};
use rand::Rng;

// pub fn random_type<T, R>(rng: &mut R) -> T where R: Rng, distributions::Standard: distributions::Distribution<T> {
Expand All @@ -20,6 +20,13 @@ where
rng.gen()
}

pub fn random_vec4<R>(rng: &mut R) -> Vec4
where
R: Rng,
{
rng.gen()
}

pub fn random_nonzero_vec3<R>(rng: &mut R) -> Vec3
where
R: Rng,
Expand Down
25 changes: 25 additions & 0 deletions benches/vec4.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#[path = "support/macros.rs"]
#[macro_use]
mod macros;
mod support;

use criterion::{criterion_group, criterion_main, Criterion};
use glam::f32::{Mat4, Vec4};
use rand::SeedableRng;
use rand_xoshiro::Xoshiro256Plus;
use std::ops::Mul;
use support::{random_srt_mat4, random_vec4};

bench_binop!(
vec4_mul_mat4,
"vec4 * mat4",
op => mul,
ty1 => Mat4,
from1 => random_srt_mat4,
ty2 => Vec4,
from2 => random_vec4
);

criterion_group!(benches, vec4_mul_mat4,);

criterion_main!(benches);

0 comments on commit de5738e

Please sign in to comment.