From hb at stat.berkeley.edu  Tue Jul 24 18:58:04 2007
From: hb at stat.berkeley.edu (Henrik Bengtsson)
Date: Tue, 24 Jul 2007 18:58:04 +0200
Subject: [Rd] dict package: dictionary data structure for R
In-Reply-To: <m2zm1n9glm.fsf@ziti.local>
References: <m28x99lbd0.fsf@ziti.fhcrc.org>
	<971536df0707211743t117cf29cx9b745f3f9d6a0dfd@mail.gmail.com>
	<m24pjxcg9f.fsf@ziti.local>
	<Pine.GSO.4.56.0707221129070.22444@durian.statsci.com>
	<m2zm1n9glm.fsf@ziti.local>
Message-ID: <59d7961d0707240958x65707eafkad22ac3056f6ea21@mail.gmail.com>

On 7/23/07, Seth Falcon <sfalcon at fhcrc.org> wrote:
> Bill Dunlap <bill at insightful.com> writes:
> > With environments, if you use a prime number for the size
> > you get considerably better results.  E.g.,
>
> > Perhaps new.env() should push the requested size up
> > to the next prime by default.
>
> Perhaps.  I think we should also investigate other hashing functions
> since computing the next prime and doing so for resizes will take
> longer than not having to do it and it will add complexity to the
> code.

An alternative is to hard-wiring primes within a reasonable range:

  http://primes.utm.edu/lists/small/millions/
  http://www.math.utah.edu/~pa/math/p10000.html

Maybe primes close to 2^n are good enough for this problem:

  http://primes.utm.edu/lists/2small/

Just my $.02

/Henrik



>
> + seth
>
> --
> Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
> http://bioconductor.org
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] dict package: dictionary data structure for R
Henrik Bengtsson