bench: replace iter::range with range syntax

This commit is contained in:
Jonathan Neuschäfer 2015-03-18 18:13:21 +01:00
parent 241441a650
commit c8cb9291ee
2 changed files with 8 additions and 9 deletions

View file

@ -21,8 +21,8 @@ macro_rules! bench_binop(
let mut rng = IsaacRng::new_unseeded();
let elems1: Vec<$t1> = range(0, LEN).map(|_| rng.gen::<$t1>()).collect();
let elems2: Vec<$t2> = range(0, LEN).map(|_| rng.gen::<$t2>()).collect();
let elems1: Vec<$t1> = (0..LEN).map(|_| rng.gen::<$t1>()).collect();
let elems2: Vec<$t2> = (0..LEN).map(|_| rng.gen::<$t2>()).collect();
let mut i = 0;
bh.iter(|| {
@ -44,8 +44,8 @@ macro_rules! bench_binop_deref(
let mut rng = IsaacRng::new_unseeded();
let elems1: Vec<$t1> = range(0, LEN).map(|_| rng.gen::<$t1>()).collect();
let elems2: Vec<$t2> = range(0, LEN).map(|_| rng.gen::<$t2>()).collect();
let elems1: Vec<$t1> = (0..LEN).map(|_| rng.gen::<$t1>()).collect();
let elems2: Vec<$t2> = (0..LEN).map(|_| rng.gen::<$t2>()).collect();
let mut i = 0;
bh.iter(|| {
@ -67,7 +67,7 @@ macro_rules! bench_unop(
let mut rng = IsaacRng::new_unseeded();
let mut elems: Vec<$t> = range(0, LEN).map(|_| rng.gen::<$t>()).collect();
let mut elems: Vec<$t> = (0..LEN).map(|_| rng.gen::<$t>()).collect();
let mut i = 0;
bh.iter(|| {
@ -89,7 +89,7 @@ macro_rules! bench_construction(
let mut rng = IsaacRng::new_unseeded();
$(let $args: Vec<$types> = range(0, LEN).map(|_| rng.gen::<$types>()).collect();)*
$(let $args: Vec<$types> = (0..LEN).map(|_| rng.gen::<$types>()).collect();)*
let mut i = 0;
bh.iter(|| {

View file

@ -20,7 +20,6 @@ extern crate test;
extern crate cgmath;
use rand::{IsaacRng, Rng};
use std::iter;
use test::Bencher;
use cgmath::{Quaternion, Basis2, Basis3, Vector3, Rotation2, Rotation3, Rad};
@ -32,8 +31,8 @@ fn bench_from_axis_angle<T: Rotation3<f32>>(bh: &mut Bencher) {
let mut rng = IsaacRng::new_unseeded();
let axis: Vec<_> = iter::range(0, LEN).map(|_| rng.gen::<Vector3<f32>>()).collect();
let angle: Vec<_> = iter::range(0, LEN).map(|_| rng.gen::<Rad<f32>>()).collect();
let axis: Vec<_> = (0..LEN).map(|_| rng.gen::<Vector3<f32>>()).collect();
let angle: Vec<_> = (0..LEN).map(|_| rng.gen::<Rad<f32>>()).collect();
let mut i = 0;
bh.iter(|| {