As I said on IRC, I've been experimenting with my own hand evaluator using prime factorization (no bit masks or bit shifting), and I was going to write a benchmark to compare it with poker-eval. Well, I wrote the benchmark and poker-eval is about 40x faster at enumerating all 5 card poker hands.
A few reasons for this... * I tested on x86. Much of my implementation does calculations on int64_t values which is probably sub-optimal on 32-bit architectures. * my implementation was designed for use with Internet Poker Protocol (IPP), so my eval function returns the results as a formatted IPP messages. * my eval function allocates a new IPP message every time its called which the benchmark has to free. 2598960+ calls to malloc and free can really slow things down ;) // libtinypoker r3830 $ time ./src/test/testEnumerateAllHands +-----------------+----------+ | Straight flush | 40 | | Four of a kind | 624 | | Full house | 3744 | | Flush | 5108 | | Straight | 10200 | | Three of a kind | 54912 | | Two Pair | 123552 | | One Pair | 1098240 | | High Card | 1302540 | +-----------------+----------+ | Total | 2598960 | +-----------------+----------+ real 0m5.731s user 0m5.672s sys 0m0.016s // poker-eval-134.0 $ time ./examples/five_card_hands NoPair : 1302540 OnePair : 1098240 TwoPair : 123552 Trips : 54912 Straight: 10200 Flush : 5108 FlHouse : 3744 Quads : 624 StFlush : 40 real 0m0.143s user 0m0.080s sys 0m0.064s _______________________________________________ Pokersource-users mailing list [email protected] https://mail.gna.org/listinfo/pokersource-users
