Deutsch   English   Français   Italiano  
<vd69c2$nscn$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Rich <rich@example.invalid>
Newsgroups: comp.lang.tcl
Subject: Re: Does cheating produce faster searches?
Date: Fri, 27 Sep 2024 12:44:50 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <vd69c2$nscn$1@dont-email.me>
References: <20240925170149.3463bec9@lud1.home> <vd52pu$ibfo$1@dont-email.me> <20240926234849.1ab3ea7c@lud1.home>
Injection-Date: Fri, 27 Sep 2024 14:44:50 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="dcce1bb59e982dc772b78d51c33e5b9d";
	logging-data="782743"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18FSNWpckIW5jcRUs7tjNxZ"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Cancel-Lock: sha1:PpJCqLLnt014W4nxrAabC56MgcM=
Bytes: 2690

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.