I have been working on a poker calculator with the ultimate goal of testing for both optimal play methods and maximal play methods using opponent modeling. Right now, I have a way to evaluate and compare 7-card poker hands with reasonable speed (~100K compares/s). However, I know it can be done faster; I currently delegate larger enumerations to an external program ("pokenum"). The speed difference is significant: the other program can compare two 2-card pockets in 0.15s, while my program takes about 15-20s. I would like to achieve similar speeds using native VB code, but I am also willing to write a C++/ASM module if necessary.

My current method is based on something I found online. It combines the card rank/suit bits using the OR operation such that it can quickly detect a flush or a straight. For other hands, it multiplies the prime numbers associated with each rank (order independent) and uses a static perfect double hash table.

In order to improve performance, I am trying to figure out a way to quickly evaluate the seven card hand using the card indexes (1-52) directly. There are three ways I thought of to do it:

1) Create a tree to store all the ~134M values (large memory requirement) and use the indexes sorted low to high as vectors

2) Create a similar tree for ranks/suits and combine them somehow (haven't figured out how to do it yet)

3) Use the prime multiplication and hash table approach again (this would still require ~134M entries however)

Is there a fast and straightforward way to use seven card indexes to translate to a hand ranking without using a ton of memory?