From: "A. Soare" <alinsoar@voila.fr>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: "Emacs Dev \[emacs-devel\]" <emacs-devel@gnu.org>
Subject: Re: van Emde Boas hash.
Date: Mon, 23 Nov 2009 15:04:41 +0100 (CET) [thread overview]
Message-ID: <24616604.12772711258985081474.JavaMail.www@wwinf4633> (raw)
> > What algorithm uses emacs for hashing the obarrays of symbols ?
>
> Read the source: C-h f intern RET then click on top right to get to the
> source code, ...
>
> It's a hash table with simple haqshing into buckets that contain linked
> lists of symbols.
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.
Hashing using van Emde Boas requires in the worst case a time of log_2(N), where N is the length of the largest symbol name in obarray.
Alin.
____________________________________________________
Derniers jours pour remporter le séjour au Maroc sur http://www.lesrevoila.fr/
next reply other threads:[~2009-11-23 14:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-23 14:04 A. Soare [this message]
2009-11-23 16:43 ` van Emde Boas hash Stefan Monnier
2009-11-23 16:57 ` David Kastrup
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=24616604.12772711258985081474.JavaMail.www@wwinf4633 \
--to=alinsoar@voila.fr \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.