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: Joel Reicher
Subject: Re: Which Elisp data structure is fastest for searching?
Date: Thu, 26 Dec 2024 17:24:54 +1100
User-agent: Gnus/5.13 (Gnus v5.13)

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 via email to

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