Add criterion benchmark
This commit is contained in:
parent
9cb7e25149
commit
6c2c34f9a3
6 changed files with 520 additions and 6 deletions
|
|
@ -7,7 +7,7 @@ use crate::misc::Map;
|
|||
|
||||
use super::{Direction, Position, COLORS};
|
||||
|
||||
#[derive(Default)]
|
||||
#[derive(Default, Clone)]
|
||||
pub struct BruteforceField {
|
||||
pub blocked: bool,
|
||||
underground_vertical: bool,
|
||||
|
|
@ -53,6 +53,7 @@ impl PathField {
|
|||
|
||||
static MAX_UNDERGROUND_LENGTH: u8 = 6;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct BruteforceBuilder {
|
||||
map: Map<BruteforceField>,
|
||||
path: Vec<[(Position, Direction); 2]>,
|
||||
|
|
@ -110,6 +111,7 @@ impl BruteforceBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct Problem {
|
||||
path: Vec<PathField>,
|
||||
end_pos: Position,
|
||||
|
|
@ -117,6 +119,7 @@ struct Problem {
|
|||
finished: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Bruteforce {
|
||||
map: Map<BruteforceField>,
|
||||
problems: Vec<Problem>,
|
||||
|
|
|
|||
|
|
@ -119,12 +119,12 @@ where
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
|
||||
use crate::{
|
||||
belt_finding::QueueObject,
|
||||
graph::wheighted_graph::{
|
||||
adjacency_list::WheightedAdjacencyList, shortest_path::dijkstra, WheightedGraph,
|
||||
},
|
||||
priority_queue::{BinaryHeap, PriorityQueue},
|
||||
priority_queue::BinaryHeap,
|
||||
};
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#[derive(Clone)]
|
||||
pub struct Map<T> {
|
||||
pub width: usize,
|
||||
pub height: usize,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue