> On 12 Dec 2016, at 14:32, Sven Van Caekenberghe <s...@stfx.eu> wrote: > > >> On 12 Dec 2016, at 18:29, Marcus Denker <marcus.den...@inria.fr> wrote: >> >> >>> On 1 Dec 2016, at 11:41, Christophe Demarey <christophe.dema...@inria.fr> >>> wrote: >>> >>> >>>> Le 1 déc. 2016 à 15:04, Marcus Denker <marcus.den...@inria.fr> a écrit : >>>> >>>> The idea that a set is always created with a minimal size is because we >>>> always add at least some elements >>> >>> not always. You know in some cases 80% of the time, your instances will >>> have an empty Set and with some values for the remaining 20%. >>> If you check in Moose, you should find a lot this pattern. >> >> It would be interesting to play around with these things… the problem is >> that they are very context dependent, so there is lots >> of questions what to do (more a research topic than something one can solve >> now…). >> >> What we should do: >> >> -> the size should be 5, like it is for Dictionaries We need to unify the >> two version of the method that calculate the initial size. >>
Issue tracker: https://pharo.fogbugz.com/f/cases/19458/unify-sizeFor-for-HashedCollection-and-Set >> What we could do: >> >> -> provide a version of “new” that actually makes explicity a small array of >> size 1. For the case where the user knows that >> the Set will be empty most of the time. > > There could be an #empty class method for that. > And one could overwrite the #with: class method to create a singleton. https://pharo.fogbugz.com/f/cases/19459/add-empty-instance-creation-method <https://pharo.fogbugz.com/f/cases/19459/add-empty-instance-creation-method> (just the issues, no code) Marcus