Skip to content

Commit

Permalink
Merge #98
Browse files Browse the repository at this point in the history
98: Update profile file, add NullLogger to perf file r=charleskawczynski a=charleskawczynski



Co-authored-by: Charles Kawczynski <kawczynski.charles@gmail.com>
  • Loading branch information
bors[bot] and charleskawczynski committed Jul 5, 2021
2 parents a130d78 + 90c3c82 commit 82895d8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
6 changes: 5 additions & 1 deletion perf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import TexasHoldem
const TH = TexasHoldem
using TexasHoldem
using BenchmarkTools
using Logging

struct BotCheckCall <: AbstractAI end

Expand All @@ -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
26 changes: 17 additions & 9 deletions profile.jl
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)

0 comments on commit 82895d8

Please sign in to comment.