Speeding up 'dictionary' search

new topic     » topic index » view thread      » older message » newer message

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

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu