Skip to content

Commit

Permalink
added tree simulate bench
Browse files Browse the repository at this point in the history
  • Loading branch information
SaschaAtWork committed Jan 10, 2025
1 parent 5cbb3bb commit df9d9b8
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/logic/depth_first/simulation/d_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ impl<Node: DNode> Display for DTree<Node> {
mod tests {
use std::time::Duration;

use test::bench;

use crate::{
logic::depth_first::{
game::{
Expand All @@ -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::<DFastField>::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");
Expand Down

1 comment on commit df9d9b8

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: df9d9b8 Previous: 0856e77 Ratio
logic::depth_first::game::d_game_state::tests::bench_possible_moves 104.72 ns/iter (± 1.50) 19.62 ns/iter (± 0.29) 5.34

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.