Skip to content

BitMask inheriting int had mixed performance results #7

@von

Description

@von

Changing BitMask to inherit int d8c199f had mixed results on performance. HoldEm, 7-card stud and 7-card stud HiLo all got slower. Omaha, Omaha HiLo and 5-card stud variants got faster.

Before:

Profiling holdem: 0.406 CPU-sec
Profiling omaha: 11.076 CPU-sec
Profiling omahahilo: 13.980 CPU-sec
Profiling fivecardstud: 0.201 CPU-sec
Profiling fivecardstudhilo: 0.291 CPU-sec
Profiling sevencardstud: 0.267 CPU-sec
Profiling sevencardstudhilo: 0.331 CPU-sec

HoldEm profile:

     273095 function calls in 0.357 CPU seconds

Ordered by: cumulative time
List reduced from 101 to 20 due to restriction <20>

ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.357 0.357 :1()
1 0.000 0.000 0.357 0.357 PokerGame.py:228(simulateGames)
100 0.005 0.000 0.356 0.004 PokerGame.py:245(simulateGame)
100 0.005 0.000 0.293 0.003 PokerGame.py:291(_findHighHands)
1000 0.005 0.000 0.275 0.000 Ranker.py:86(rankHand)
1000 0.029 0.000 0.264 0.000 Ranker.py:106(_rankHand)
1000 0.048 0.000 0.100 0.000 Ranker.py:31(_suitedBitFieldsToRankedBitFields)
4948 0.034 0.000 0.051 0.000 Ranker.py:73(_hasStraight)
200 0.009 0.000 0.029 0.000 Deck.py:73(dealHands)
1000 0.005 0.000 0.023 0.000 PokerRank.py:77(init)
7000 0.012 0.000 0.023 0.000 BitField.py:199(or)
22521 0.016 0.000 0.022 0.000 BitField.py:220(getOtherValue)
42743 0.020 0.000 0.020 0.000 {isinstance}
6000 0.011 0.000 0.020 0.000 BitField.py:193(and)
6000 0.010 0.000 0.019 0.000 BitField.py:196(xor)
1000 0.012 0.000 0.018 0.000 Ranker.py:11(_handToSuitedBitFields)
54116 0.017 0.000 0.017 0.000 BitField.py:97(testBits)
5269 0.006 0.000 0.016 0.000 Utils.py:11(assertInstance)
2500 0.002 0.000 0.015 0.000 Cards.py:249(addCard)
24000 0.015 0.000 0.015 0.000 BitField.py:14(init)

After:

Profiling holdem: 0.778 CPU-sec (doubled!)
Profiling omaha: 8.330 CPU-sec (down 20%)
Profiling omahahilo: 10.715 CPU-sec (down 20-30%)
Profiling fivecardstud: 0.178 CPU-sec (Down 10%)
Profiling fivecardstudhilo: 0.233 CPU-sec (Down 20%)
Profiling sevencardstud: 0.566 CPU-sec (Doubled)
Profiling sevencardstudhilo: 0.603 CPU-sec (up 50%)

HoldEm profile:

509229 function calls in 0.773 CPU seconds

Ordered by: cumulative time
List reduced from 96 to 20 due to restriction <20>

ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.773 0.773 :1()
1 0.000 0.000 0.773 0.773 PokerGame.py:228(simulateGames)
100 0.005 0.000 0.772 0.008 PokerGame.py:245(simulateGame)
100 0.003 0.000 0.707 0.007 PokerGame.py:291(_findHighHands)
1000 0.005 0.000 0.704 0.001 Ranker.py:88(rankHand)
1000 0.022 0.000 0.693 0.001 Ranker.py:108(_rankHand)
4933 0.038 0.000 0.318 0.000 Ranker.py:75(_hasStraight)
54024 0.072 0.000 0.280 0.000 BitField.py:102(testBits)
65435 0.127 0.000 0.252 0.000 BitField.py:163(and)
117588 0.175 0.000 0.226 0.000 BitField.py:14(new)
1964 0.002 0.000 0.118 0.000 BitField.py:73(highestSet)
1964 0.028 0.000 0.116 0.000 BitField.py:179(shiftsUntilZero)
983 0.009 0.000 0.100 0.000 BitField.py:81(highestNSet)
23201 0.044 0.000 0.088 0.000 BitField.py:172(rshift)
999 0.019 0.000 0.079 0.000 Ranker.py:33(_suitedBitFieldsToRankedBitFields)
1000 0.017 0.000 0.054 0.000 Ranker.py:11(_handToSuitedBitFields)
117788 0.051 0.000 0.051 0.000 {built-in method new of type object at 0x155000}
8163 0.017 0.000 0.033 0.000 BitField.py:107(add)
934 0.005 0.000 0.031 0.000 BitField.py:115(filterBits)
200 0.009 0.000 0.029 0.000 Deck.py:73(dealHands)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions