diff --git a/src/logic/depth_first/simulation/d_tree.rs b/src/logic/depth_first/simulation/d_tree.rs index b28dca7..e533710 100644 --- a/src/logic/depth_first/simulation/d_tree.rs +++ b/src/logic/depth_first/simulation/d_tree.rs @@ -368,6 +368,8 @@ impl Display for DTree { mod tests { use std::time::Duration; + use test::bench; + use crate::{ logic::depth_first::{ game::{ @@ -388,6 +390,28 @@ mod tests { read_game_state, }; + #[bench] + fn bench_tree_simulate(b: &mut bench::Bencher) { + let gamestate = read_game_state("requests/test_move_request.json"); + let state = DGameState::::from_request( + &gamestate.board, + &gamestate.you, + &gamestate.turn, + ); + + b.iter(|| { + let root = DFullSimulationNode::new( + DNodeId::default(), + vec![state.clone()], + DTreeTime::default(), + DNodeStatus::default(), + None, + ); + let mut tree = DTree::default().root(root).max_depth(4); + tree.simulate() + }); + } + #[test] fn test_simulate_with_pessimistic_capture_node() { let gamestate = read_game_state("requests/test_move_request.json");