[squeak-dev] Inconsistent growing behavior of Streams and Collections

Marcel Taeumel marcel.taeumel at hpi.de
Mon Feb 27 10:48:58 UTC 2023


Hi all --

What is the best growing strategy we currently have and can we use it consistently in the image?

1) HashedCollection (i.e., Dictionary etc.)
- growing is rather clever via prime table and max. 75% load factor
- see #growSize

2) OrderedCollection
- grow if less than 50% free space (see #makeRoomAt*)
- grow by 100% (see #growAt*)

3) WriteStream (e.g., String streamContents: [...])
- !! grow by 100% (at most 1 Million !) via #grownBy: for #nextPut:/#pastEndPut: (and #nextPutAll: for Strings)
- grow by min+25% via #growTo: for #nextPutAll: (for non-strings)


---

Well, using "String streamContents: [...]" is *really* slow for very large strings (e.g., > 100 MB) bc. it triggers a lot of full GCs bc. #grownBy: only adds a 1 megabyte at most per grow. Therefore, our JSON support suffers a serious performance impact when using #asJsonString on larger structures.

Best,
Marcel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20230227/db5dd7ef/attachment.html>


More information about the Squeak-dev mailing list