I've been working on a Scrabble-like game for a few days because I really wanted to convert a board game to an enjoyable experience as a videogame.
It's been quite challenging, but it works almost perfectly now and is pretty fast in finding and scoring.
The slowest part of the whole game though was the checking if words were valid.
I found a huge dictionary file on the web and modified it so it would follow the rules of scrabble as much as possible.
This file was way too big though: 2MB of words, tens of thousands of lines that had to be read to check every word!
It would take about 3 seconds to load on my PC and about 6-8 seconds on my phone!
That's clearly unacceptable, so I thought of a solution: I wrote a small windows program that can take a huge file, and spit out a small file for every different starting letter in the big file.
So now I have all these small text files, I can search for valid words much faster, I just pick the appropriate file to read depending on the starting letter of the word that needs to be checked.
This change made the checking more than 20 times faster! It loads almost instantly on the PC now and it take takes less than a second on my phone. Definitely worth it.
I can't show the game itself yet, but I'll post about it when it's finished.