#![feature(test)]
extern crate test;
extern crate worley_noise;
use test::Bencher;
use worley_noise::WorleyNoise;
const WIDTH: u32 = 50;
const HEIGHT: u32 = 50;
const DEPTH: u32 = 50;
#[bench]
fn create(b: &mut Bencher) {
b.iter(|| {
WorleyNoise::new();
});
}
#[bench]
fn sample(b: &mut Bencher) {
let capacity = (WIDTH * HEIGHT) as usize;
let noise = WorleyNoise::with_cache_capacity(capacity);
let mut points = Vec::with_capacity(capacity);
for x in 0 .. WIDTH {
for y in 0 .. HEIGHT {
for z in 0 .. DEPTH {
points.push((x as f64, y as f64, z as f64));
}
}
}
b.iter(|| noise.values_3d(&points));
}