doy/games-word — pull request #1 by srollyson (2012-07-05 03:23:11+00:00)
Title: Some optimizations for large wordlist anagrams and subwords.

Hi Jesse,

Thanks for publishing your **Games-Word** distribution on CPAN! I used it to make a [solver](https://github.com/srollyson/scripts/blob/master/every_word_solver.pl) for the game [*Every Word*](http://www.amazon.com/Every-Word/dp/B003P37FW0) on the Kindle.

I noticed that `Games::Word::Wordlist::anagrams` and `Games::Word::Wordlist::subwords_of` took quite a while to run on my system when they were called on a `Games::Word::Wordlist` object containing a large list of words (e.g. from `/usr/share/dict/words`).

This pull request is my attempt to trade memory for speed to make those functions more usable in my particular use case. It still doesn't help much when you're feeding a large character set to those functions because permutations of that size are inherently expensive, but it does make things a little speedier for character sets smaller than, say, 10 characters.

It passes all the tests in the dist, including `t/024-anagrams.t` and `t/025-subwords.t`. Hope you like it!

Stephen.