mirror of
https://codeberg.org/icewind/vbsp.git
synced 2026-06-03 18:54:05 +02:00
update benches
This commit is contained in:
parent
96e30bf6a0
commit
1fd2f3800a
3 changed files with 13 additions and 12 deletions
|
|
@ -3,28 +3,28 @@
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
||||||
mod benches {
|
mod benches {
|
||||||
use bsp::Bsp;
|
|
||||||
use test::Bencher;
|
use test::Bencher;
|
||||||
|
use vbsp::{Bsp, Vector};
|
||||||
|
|
||||||
const MAP_BYTES: &[u8] = include_bytes!("../test.bsp");
|
const MAP_BYTES: &[u8] = include_bytes!("../koth_bagel_rc2a.bsp");
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn from_bytes(b: &mut Bencher) {
|
fn from_bytes(b: &mut Bencher) {
|
||||||
use std::io::Cursor;
|
|
||||||
|
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
Bsp::read(&mut Cursor::new(MAP_BYTES)).unwrap();
|
Bsp::read(&MAP_BYTES).unwrap();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn leaf_at(b: &mut Bencher) {
|
fn leaf_at(b: &mut Bencher) {
|
||||||
use std::io::Cursor;
|
let bsp = Bsp::read(&MAP_BYTES).unwrap();
|
||||||
|
|
||||||
let bsp = Bsp::read(&mut Cursor::new(MAP_BYTES)).unwrap();
|
|
||||||
|
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
test::black_box(bsp.leaf_at(test::black_box([0., 0., 0.])));
|
test::black_box(bsp.leaf_at(test::black_box(Vector {
|
||||||
|
x: 0.,
|
||||||
|
y: 0.,
|
||||||
|
z: 0.,
|
||||||
|
})));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -218,9 +218,9 @@ impl BinRead for Name {
|
||||||
|
|
||||||
#[derive(Debug, Clone, BinRead)]
|
#[derive(Debug, Clone, BinRead)]
|
||||||
pub struct Vector {
|
pub struct Vector {
|
||||||
x: f32,
|
pub x: f32,
|
||||||
y: f32,
|
pub y: f32,
|
||||||
z: f32,
|
pub z: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Vector {
|
impl Vector {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ mod data;
|
||||||
mod reader;
|
mod reader;
|
||||||
|
|
||||||
use crate::bspfile::LumpType;
|
use crate::bspfile::LumpType;
|
||||||
|
pub use crate::data::Vector;
|
||||||
use crate::data::*;
|
use crate::data::*;
|
||||||
use binread::io::Cursor;
|
use binread::io::Cursor;
|
||||||
use binread::BinRead;
|
use binread::BinRead;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue