[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Re: Dictionary>>#addAll: fails

From: Stephen Compall
Subject: [Help-smalltalk] Re: Dictionary>>#addAll: fails
Date: Thu, 29 Mar 2007 16:35:24 -0500

On Mon, 2007-03-26 at 09:21 +0200, Paolo Bonzini wrote:
> Well, it's there because a hash table needs more room than it has
> elements.

May I suggest instead smalltalk--backstage--2.2--patch-13:

        * kernel/ Treat new:'s argument as a requested

This has the added benefit of meeting:

Refinement: <Dictionary factory>
  The parameter count represents a hint for space allocation. The new 
collection is to optimized to
  contain count elements. The new collection initially contains no elements.

The reason I didn't notice this earlier was because for every size 1
bitShift: (size * 3 // 4) highBit => size. :)

HashedCollection>>withAll:'s definition might also want to change,
depending on what you think the probability of adding keys versus the
space savings of leaving off * 2 would be.

;;; Stephen Compall ** **
Failure to imagine vast possibilities usually stems from a lack of
imagination, not a lack of possibility.

Attachment: gst-hashedcoll-new.diff
Description: Text Data

Attachment: signature.asc
Description: This is a digitally signed message part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]