1/ write in in a proper language like C
2/. use a database to store stuff in which has fast algortihms for
dealing with matrix type stuff.
because it sounds like that's what you have - a 2D matrix of integers
you could produce e.g a row hash and index that which would make it fast
to check if you have a POSSIBLE match, and then sort through any
possibles to see if they are exactmatches.
depending on the size though,I'd be tempted to make it a C coded RAM
based thing.
preferably using statically allocated memory if you know a maximum size,
to avoid pointer indirection stuff.
If its huge, I'd use a database and a hash table.
--
Ineptocracy
(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.