Speeding up 'dictionary' search
- Posted by newphil82 Jul 20, 2016
- 1491 views
I coded a program that scanned a "dictionary" file for 100's of words. It was slow. The "dictionary" was vast, not perfectly sorted. I made a very simple copy program that "sorted" by the initial letter only. (Using 'lower' and 26 scans!) Then I set 'constants' for the start_at and stop_at bytes for each initial letter - for seek() and where(). Better!
But this seems to be of more general interest (unless I'm missing something!)?
1:- if equal(inword, dictionary_word) then ...
2:- if dictionary_word[2] = second_letter and equal(inword, dictionary_word) then ...
The added one-byte test actually IMPROVED the speed a bit! (Your speed tips, please?)
Phil