[squeak-dev] The Inbox: Collections-ul.933.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Sat May 1 17:53:20 UTC 2021

Hi Levente,

so what is now the official interface for creating a valid collection of any kind of a certain size n? Shall we always use #ofSize:? Is this something that should be documented in the release notes?



Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Dienstag, 27. April 2021 17:07:18
An: squeak-dev
Betreff: Re: [squeak-dev] The Inbox: Collections-ul.933.mcz

+1 I suppose =)

It's faster then:

[OrderedCollection streamContents: [:s | s nextPut: #apple]] bench

BEFORE: '2,630,000 per second. 380 nanoseconds per run. 16.13677 % GC time.'
AFTER: '3,990,000 per second. 251 nanoseconds per run. 15.89682 % GC time.'


Am 31.03.2021 02:19:03 schrieb commits at source.squeak.org <commits at source.squeak.org>:

Levente Uzonyi uploaded a new version of Collections to project The Inbox:

==================== Summary ====================

Name: Collections-ul.933
Author: ul
Time: 31 March 2021, 2:17:52.141067 am
UUID: b290ad2c-2ed0-4d46-b2fe-12545bf5f31c
Ancestors: Collections-ul.932

- use #ofSize: instead of #new: in SequenceableCollection class >> new:streamContents:, so that it creates a stream on a non-empty collection even if the receiver is OrderedCollection.

=============== Diff against Collections-ul.932 ===============

Item was changed:
----- Method: SequenceableCollection class>>new:streamContents: (in category 'stream creation') -----
new: newSize streamContents: blockWithArg

| stream originalContents |
+ stream := WriteStream on: (self ofSize: newSize).
- stream := WriteStream on: (self new: newSize).
blockWithArg value: stream.
originalContents := stream originalContents.
+ ^originalContents size = stream position
+ ifTrue: [ originalContents ]
+ ifFalse: [ stream contents ]!
- originalContents size = stream position
- ifTrue: [ ^originalContents ]
- ifFalse: [ ^stream contents ]!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210501/ac37e8c8/attachment.html>

More information about the Squeak-dev mailing list