-
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.
41: Small performance improvements r=charleskawczynski a=charleskawczynski Co-authored-by: Charles Kawczynski <kawczynski.charles@gmail.com>
- Loading branch information
Showing
4 changed files
with
58 additions
and
29 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
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
628b503
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
628b503
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/88260
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: