If I were looking up a table with only 100,000 words and wanted it to be
fast -
CASE OF SEARCHING ON WORD
a. If it is a fixed table. Sort into alpha sequence in a flat file,
open and memory map the file and use a binary search. Very simple and
fast and would find your word in a few microseconds.
b. If the table is dynamic make the file an AVL tree. Also very fast
and quite simple and self maintaining.
c. Make it an SQLITE table and make the word an index. Simple and quite
fast.
CASE OF SEARCHING ON A SUBSTRING
a. Simple string. Memory map the file of name and search using a fast
string algorithm like Boyer-Moore. Will perform in a few milliseconds.
b. Complex search. Memory map the file and use the REGEX library.
Quite fast.
c. complex search. Use Sqlite table and perform a LIKE or regular
expression search (slower because it has to access row-by-row).
If you have a much larger table hashing the words to a token may be
better, but at only 100,000 my guess is that you are well below that
threshold.
Cesar David Rodas Maldonado wrote:
Hello to everybody
If I have a table with 100.000 unique words I am wondering if SQLite
select
if faster an cheaper (RAM, Processor, etc), or If i have to help SQLite
using a Hash function, and what could be that Hash function?
Thanks.