Skip to content

Commit

Permalink
Make the Rubykon benchmark 10x faster per iteration (#335)
Browse files Browse the repository at this point in the history
To alleviate warm-up duration issues, we can shorten the
per-iteration time for benchmarks where it's particularly long.
  • Loading branch information
maximecb authored Sep 27, 2024
1 parent 6a6c3a3 commit 33a3512
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ rack:
ruby-json:
desc: an optimized version of the json_pure gem's pure Ruby JSON parser.
rubykon:
desc: Ruby solver for Go (the boardgame.) Runs 1,000 iterations forward from an initial starting board.
desc: Ruby solver for Go (the boardgame.) Runs many iterations forward from an initial starting board.
tinygql:
desc: TinyGQL gem parsing a large file in pure Ruby
nqueens:
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/rubykon/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
# Note: it's hard to validate correct behaviour because it's a Monte Carlo tree search. It doesn't
# return the same stable best_move, even for identical initial board state and number of iterations.

ITERATIONS = 1000
game_state_19 = Rubykon::GameState.new Rubykon::Game.new(19)
ITERATIONS = 100
game_state = Rubykon::GameState.new Rubykon::Game.new(19)
mcts = MCTS::MCTS.new

run_benchmark(10) do
mcts.start game_state_19, ITERATIONS
mcts.start game_state, ITERATIONS
end

0 comments on commit 33a3512

Please sign in to comment.