diff --git a/perf.jl b/perf.jl index a901de49..657e1512 100644 --- a/perf.jl +++ b/perf.jl @@ -2,6 +2,7 @@ import TexasHoldem const TH = TexasHoldem using TexasHoldem using BenchmarkTools +using Logging struct BotCheckCall <: AbstractAI end @@ -11,4 +12,7 @@ TH.player_option!(game::Game, player::Player{BotCheckCall}, ::AbstractGameState, TH.player_option!(game::Game, player::Player{BotCheckCall}, ::AbstractGameState, ::CallFold) = call!(game, player) players() = ntuple(i->(Player(BotCheckCall(), i)), 4) -@benchmark play!(Game(players())) + +@benchmark with_logger(NullLogger()) do + play!(Game(players())) +end diff --git a/profile.jl b/profile.jl index f9c833e2..95e82eb5 100644 --- a/profile.jl +++ b/profile.jl @@ -1,8 +1,8 @@ -using Profile -using PlayingCards -using TexasHoldem import TexasHoldem const TH = TexasHoldem +using TexasHoldem +using BenchmarkTools +using Logging struct BotCheckCall <: AbstractAI end @@ -11,11 +11,19 @@ TH.player_option!(game::Game, player::Player{BotCheckCall}, ::AbstractGameState, TH.player_option!(game::Game, player::Player{BotCheckCall}, ::AbstractGameState, ::CallAllInFold) = call!(game, player) TH.player_option!(game::Game, player::Player{BotCheckCall}, ::AbstractGameState, ::CallFold) = call!(game, player) -function main(n_games) - players = ntuple(i->(Player(BotCheckCall(), i)), 10) - play(Game(players)) +players() = ntuple(i->(Player(BotCheckCall(), i)), 4) + +with_logger(NullLogger()) do + play!(Game(players())) +end + +using Profile +@profile begin + for k in 1:100 + with_logger(NullLogger()) do + play!(Game(players())) + end + end end -main(1) # Compile first: -@profile main(10) # time -# Profile.print() +Profile.print(format=:flat, sortedby=:count)