-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid broadcast, add benchmark script
- Loading branch information
1 parent
eeefde0
commit 8143ed6
Showing
3 changed files
with
57 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using PlayingCards | ||
using PlayingCards: AbstractDeck | ||
import Random | ||
Random.seed!(1234) | ||
import PokerHandEvaluator as PHE | ||
|
||
struct DummyDeck <: AbstractDeck | ||
cards::Vector{Card} | ||
end | ||
Base.pop!(deck::DummyDeck, n::Int) = ntuple(i->deck.cards[i], n) | ||
Random.shuffle!(deck::DummyDeck) = Random.shuffle!(Random.default_rng(), deck) | ||
|
||
function Random.shuffle!(rng::Random.AbstractRNG, deck::DummyDeck) | ||
Random.shuffle!(rng, deck.cards) | ||
return deck | ||
end | ||
|
||
function do_work!(deck) | ||
fhe = PHE.FullHandEval(pop!(deck, 7)) | ||
shuffle!(deck) | ||
end | ||
|
||
deck = DummyDeck(full_deck()) | ||
using BenchmarkTools | ||
@benchmark do_work!($deck) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters