Luc
2024-09-25 20:01:49 UTC
Suppose I have a large list. Very large list. Then I want to search
for an item in that string:
% lsearch $list "string"
Now, suppose I have many lists instead. One list contains all the items
that begin with the letter a, another list contains all the items that
begin with the letter b, another list contains all the items that begin
with the letter c, and so on. Then I see what the first character in
"string" is and only search for it in the one corresponding list.
Would that be faster? I somehow suspect the answer is 'no.'
Bonus question: what about sqlite operations? Would they be faster if
I had one separate table for each initial letter/character?
TIA
for an item in that string:
% lsearch $list "string"
Now, suppose I have many lists instead. One list contains all the items
that begin with the letter a, another list contains all the items that
begin with the letter b, another list contains all the items that begin
with the letter c, and so on. Then I see what the first character in
"string" is and only search for it in the one corresponding list.
Would that be faster? I somehow suspect the answer is 'no.'
Bonus question: what about sqlite operations? Would they be faster if
I had one separate table for each initial letter/character?
TIA
--
Luc
Luc