On 12 Dec 2016, at 14:32, Sven Van Caekenberghe <sven@stfx.eu> wrote:On 12 Dec 2016, at 18:29, Marcus Denker <marcus.denker@inria.fr> wrote:On 1 Dec 2016, at 11:41, Christophe Demarey <christophe.demarey@inria.fr> wrote:Le 1 d��c. 2016 �� 15:04, Marcus Denker <marcus.denker@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.
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.