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.
Marcus