Gnus development mailing list
 help / color / mirror / Atom feed
From: Jim Meyering <meyering@asic.sc.ti.com>
Subject: Re: Red Gnus v0.76 is released
Date: 16 Dec 1996 22:36:33 -0600	[thread overview]
Message-ID: <wpgzpzdokha.fsf@asic.sc.ti.com> (raw)
In-Reply-To: Lars Magne Ingebrigtsen's message of 16 Dec 1996 23:47:43 +0100

Lars Magne Ingebrigtsen <larsi@ifi.uio.no> writes:
| Thu Dec 12 18:18:11 1996  David Moore  <dmoore@ucsd.edu>
| 
| 	* gnus-util.el (gnus-create-hash-size): Power of 2 hashtables can
| 	be _significantly_ faster than 2^x-1 tables on many risc
| 	machines.  Any gains of 2^x-1 are comparably small on other
| 	machines. 

Hi.

Have you considered any other implications of changing the table size
to be a power of 2?  It's pretty generally accepted that hash tables
get better key distributions (fewer collisions) when the table size
is a prime -- or has relatively few factors.  A bad table size (and
powers of 2 are notoriously bad) can make the normally-very-efficient
(O(1)) insert/delete/lookup operations abyssymally slow O(n) ones.

I suspect that choosing table size == 2^N (rather than the
usually-good and sometimes-even-prime 2^N - 1) would degrade the
efficiency due to the increased frequency of collisions.

Whether this matters depends on how full the tables may become.
If they're always nearly empty, then don't worry.  If they ever
contain more than say, 0.6 * table_size elements, I'd start to worry.
In general, if you have the memory, it's best to keep your tables
under 75% full.  That latter is from Knuth.  The 0.6 is my gut
feeling.  The 2^N business is from memory of Knuth and probably
others.


  reply	other threads:[~1996-12-17  4:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-16 22:47 Lars Magne Ingebrigtsen
1996-12-17  4:36 ` Jim Meyering [this message]
1996-12-17  6:26   ` David Moore

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=wpgzpzdokha.fsf@asic.sc.ti.com \
    --to=meyering@asic.sc.ti.com \
    --cc=meyering@na-net.ornl.gov \
    /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 NNTP newsgroup(s).