Sujet : Re: Does cheating produce faster searches?
De : rich (at) *nospam* example.invalid (Rich)
Groupes : comp.lang.tclDate : 27. Sep 2024, 13:44:50
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vd69c2$nscn$1@dont-email.me>
References : 1 2 3
User-Agent : tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Luc <
luc@sep.invalid> wrote:
On Thu, 26 Sep 2024 18:46:36 -0700, Shaun Deacon wrote:
Depending very much on what you want to do with the result from your
search, and speed is your primary concern, there may be another way to
approach this...
>
If you're just checking for whether a word exists in some word list,
have you considered creating array variables ?
Right now, at this very exact moment, I am toying with a real time
search box, and by "real time" I mean the search output changes with
every new character typed into the user input widget. But I'm always
searching for all kinds of stuff when I code. It's a very common need.
Interesting idea with the array variables. Thank you for your input.
Do note that reality is that the method that turns out to be "fastest"
is a "it depends" (and upon several variables, including at least the
size of the data you want to search).
To determine which is actually fastest, you need your data set, and you
need to do some experiments with all the default options using Tcl's
[time] command to determine how long each takes.
And, if you really want to test, you also need to test against
alternate methods of storage and search to see if one of those
alternates is actually faster. Given the 'hint' you've given above,
you might find that something like a prefix trie
(
https://en.wikipedia.org/wiki/Trie), esp. one built as a C extension,
is faster than any of the default Tcl built in operators. You are
crossing over the boundary with this post from "general purpose search,
with reasonable performance" into "specialized searching, for fastest
performance". And the realm of specialization in this area can be both
wide and deep.