help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Which Elisp data structure is fastest for searching?


From: Jean Louis
Subject: Re: Which Elisp data structure is fastest for searching?
Date: Thu, 26 Dec 2024 11:53:38 +0300
User-agent: Mutt/2.2.12 (2023-09-09)

* Joel Reicher <joel.reicher@gmail.com> [2024-12-26 09:25]:
> > A hash table is a very fast kind of lookup table, somewhat like an alist
> > (*note Association Lists::) in that it maps keys to corresponding
> > values.
> > 
> > The above is not so conclusive and I have not done measurements.
> > 
> > It says "somewhat like an alist", but is the alist faster in searching
> > through elements or the hash table?
> 
> It depends on the kind of search you are doing. As an extreme example,
> imagine your search was not based on the hash table key; you might have to
> go through every entry in the table to find what you're looking for.
> 
> This is why different data structures exist. There is no "best"; only "best
> for..."

As is written in manual that hash table is very fast, I believe yes,
though my search may not be.

I will use following approach:

- there will be list or hash with values that are to be searched,
  those values will have their ID, that information will be prepared
  for easier searching, like special symbols removed, only words
  remaining, maybe even small words could be removed

- there will be different hash with accurate information about the ID,
  such as title, URL, description

That is approach I know. Then I can give relevant information for
website search.

I wonder if Emacs can remain in memory keeping to answer HTTP
requests, so that I do not load it every time.

-- 
Jean Louis



reply via email to

[Prev in Thread] Current Thread [Next in Thread]