The nice way of doing this would be to have a layer of indirection so that the storage strategy decides how to use the hashed storage. However, compared to the current Set/Dictionary implementation, that may be a bit slower. It would not be a terrific idea to have multiple subclasses of Set/Dictionary depending on the storage strategy, as that would result in an explosion of classes.
John M McIntosh wrote: > In the far past Visual Age would become the implementation logic for > Sets depending > on how big the set was, so for example with 10 elements it would be > linear list. Of course > it's been 14 years, perhaps I'm remembering it wrong. > > On 2009-10-22, at 6:46 AM, Lukas Renggli wrote: > > >>> So this means that by default we have bad performance. no? >>> >> No. >> >> In a fresh Pharo Web image less than 6% of the keys in Dictionaries >> and less than 10% of the values in Sets have a weak-hashes. Moreover >> the largest set with weak-hash values has 516 elements (on average >> only 1.8 elements), the largest dictionary with weak-hash keys has >> 1002 elements (on average only 4.3 elements). Using HashTable in such >> a situation would introduce a major speed penalty and waste a lot of >> memory. >> >> It would be cool if the Set and the Dictionary would choose their >> implementation strategy automatically depending on the use-case. In a >> standard Pharo image however that would just be the current >> implementation. There are simply no instances in the image where it >> would be worthwhile (large amount of data with bad hash) to use a >> HashMap. >> >> Lukas >> >> -- >> Lukas Renggli >> http://www.lukas-renggli.ch >> >> _______________________________________________ >> Pharo-project mailing list >> [email protected] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > > -- > = > = > = > ======================================================================== > John M. McIntosh <[email protected]> Twitter: > squeaker68882 > Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com > = > = > = > ======================================================================== > > > > > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
