[Vm-dev] [squeak-dev] [Pharo-dev] Byte & String collection hash performance; a modest proposal for change.

Eliot Miranda eliot.miranda at gmail.com
Mon May 1 18:55:26 UTC 2017


On Mon, May 1, 2017 at 10:37 AM, Tony Garnock-Jones <tonyg at ccs.neu.edu>
wrote:

> On 5/1/17 1:26 PM, Levente Uzonyi wrote:
> > I presume that a general purpose in-image solution would be more
> > complex. String already has too many subclasses (6 in Squeak), while at
> > the same time other kind of new subclasses would be welcome too, e.g.
> > Strings with 2-byte characters.
> > Since these properties are orthogonal, there would be many new
> > subclasses to cover all cases.
>
> A classic motivating case for Traits, right?
>

Alas no.  The problem with String's subclasses is that they're binary
objects.  They have no inst vars in which one can cache a hash.  They're
juts a flat vector of bytes.  If one added a trait to them the system would
fail because there's no way to add an inst var to a binary object in the
current Smalltalk object representation.  hence Levente's very clever idea
of hiding the hash in a hidden header word.


> Tony
>
>


-- 
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20170501/e795f2c7/attachment.html>


More information about the Vm-dev mailing list