~bonbon/gmcts

f53b192c1ddff9153b94206d26e077508f4ca65e — bonbon 1 year, 5 months ago 988d281
add mcts benchmark for tic-tac-toe
1 files changed, 24 insertions(+), 0 deletions(-)

M mcts_test.go
M mcts_test.go => mcts_test.go +24 -0
@@ 146,3 146,27 @@ func TestTerminalState(t *testing.T) {
		t.FailNow()
	}
}

func BenchmarkTicTacToe1KRounds(b *testing.B) {
	mcts := NewMCTS(tttGame{tictactoe.NewGame()})
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		mcts.SpawnTree().SearchRounds(1000)
	}
}

func BenchmarkTicTacToe10KRounds(b *testing.B) {
	mcts := NewMCTS(tttGame{tictactoe.NewGame()})
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		mcts.SpawnTree().SearchRounds(10000)
	}
}

func BenchmarkTicTacToe100KRounds(b *testing.B) {
	mcts := NewMCTS(tttGame{tictactoe.NewGame()})
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		mcts.SpawnTree().SearchRounds(100000)
	}
}