[R] Dynamic Dictionary Data Type?
Duncan Murdoch
murdoch at stats.uwo.ca
Thu Jun 2 19:24:05 CEST 2005
Gabor Grothendieck wrote:
> On 6/2/05, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
>
>>On Thu, 2 Jun 2005, hadley wickham wrote:
>>
>>
>>>>An environment is a hash table, and copying occurs only on modification,
>>>>when any language would have to copy in this context.
>>
>>Caveat: the default is new.env(hash=FALSE), so an environment is a hash
>>table in one sense but not necessarily so in the strict sense.
>
>
> Can you expand on this? When would one use hash = TRUE vs.
> the default?
It's an optimization question. hash = TRUE uses more memory and takes
longer to set up, but will give faster searches in big environments.
The current default assumes that environments are small so the effort of
building the hash table is not worthwhile, and it does linear searches.
I suspect that we might have the default wrong (or perhaps should make
the transition from linear to hash search automatically at a certain
threshold size), but I haven't done the testing necessary to show this.
Duncan Murdoch
More information about the R-help
mailing list