From: David Kastrup <dak@gnu.org>
To: emacs-devel@gnu.org
Subject: Re: van Emde Boas hash.
Date: Mon, 23 Nov 2009 17:57:27 +0100 [thread overview]
Message-ID: <87ocmt2n7s.fsf@lola.goethe.zz> (raw)
In-Reply-To: jwv7hth5h1i.fsf-monnier+emacs@gnu.org
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> As far as I understand, the algorthm is so:
>
>> oblookup ( obarray, sym )
>
>> ;; hash is an integer, the index of a bucket that may contain sym
>> hash = hash_string (sym)
>> ;; bucket is a vector. obarray is a vector of many buckets
>> bucket = obarray [hash]
>> ;; search sym in its bucket using a naive search
>> FOR every symbol S in bucket, check whether S has the same name
>> as sym. If so, return S. If no symbol matches, returns the hash.
>
>
>> Even if it is very unlikely that we can find many symbols into
>> a bucket, the algorithm does not require constant time for
>> every search.
>
> Yes, it's a very simple hashing algorithm. I'm sure we can come up
> with something more efficient. Then again, I haven't seen any
> indication that this is a performance problem.
I should think that it makes up a sizeable portion of byte-recompiling
and autoloading, both of which are not often benchmarked. But it isn't
something which you commonly do on data sets in a loop. Scanning files
is done just once usually.
--
David Kastrup
next prev parent reply other threads:[~2009-11-23 16:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-23 14:04 van Emde Boas hash A. Soare
2009-11-23 16:43 ` Stefan Monnier
2009-11-23 16:57 ` David Kastrup [this message]
2009-11-27 9:04 ` A Soare
-- strict thread matches above, loose matches on Subject: below --
2009-11-27 18:01 A. Soare
2009-11-22 12:35 A. Soare
2009-11-23 2:25 ` Stefan Monnier
2009-11-20 6:41 A. Soare
2009-11-23 4:06 ` tomas
2009-11-23 14:39 ` A Soare
2009-11-19 12:04 A. Soare
2009-11-19 15:23 ` Stefan Monnier
2009-11-19 16:44 ` Deniz Dogan
2009-11-27 9:14 ` A Soare
2009-11-27 16:56 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ocmt2n7s.fsf@lola.goethe.zz \
--to=dak@gnu.org \
--cc=emacs-devel@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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.