unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Joel Reicher <joel.reicher@gmail.com>
To: Jean Louis <bugs@gnu.support>
Cc: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Which Elisp data structure is fastest for searching?
Date: Thu, 26 Dec 2024 17:24:54 +1100	[thread overview]
Message-ID: <86wmfnc66h.fsf@gmail.com> (raw)
In-Reply-To: <bee3d87f04f559f0e0d409893dda5ef7.support1@rcdrun.com> (Jean Louis's message of "Wed, 25 Dec 2024 12:33:08 +0300")

Jean Louis <bugs@gnu.support> writes:

[...]

> 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..."

Regards,

        - Joel



  reply	other threads:[~2024-12-26  6:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-25  9:33 Which Elisp data structure is fastest for searching? Jean Louis
2024-12-26  6:24 ` Joel Reicher [this message]
2024-12-26  8:53   ` Jean Louis
2024-12-26  9:23     ` tomas
2024-12-26 11:49       ` Jean Louis
2024-12-26 23:03     ` Joel Reicher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86wmfnc66h.fsf@gmail.com \
    --to=joel.reicher@gmail.com \
    --cc=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).