<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
+1 I suppose =)<div><br></div><div>It's faster then:</div><div><br></div><div><div><span style="font-size: 13.3333px">[OrderedCollection streamContents: [:s | s</span> nextPut: #apple]] bench </div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">BEFORE: '2,630,000 per second. 380 nanoseconds per run. 16.13677 % GC time.'</span></div><div><span style="font-size: 13.3333px">AFTER: '3,990,000 per second. 251 nanoseconds per run. 15.89682 % GC time.'</span></div></div><div><br></div><div>Best,</div><div>Marcel</div><div class="mb_sig"></div>
<blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
<p style="color: #AAAAAA; margin-top: 10px;">Am 31.03.2021 02:19:03 schrieb commits@source.squeak.org <commits@source.squeak.org>:</p><div style="font-family:Arial,Helvetica,sans-serif">Levente Uzonyi uploaded a new version of Collections to project The Inbox:<br>http://source.squeak.org/inbox/Collections-ul.933.mcz<br><br>==================== Summary ====================<br><br>Name: Collections-ul.933<br>Author: ul<br>Time: 31 March 2021, 2:17:52.141067 am<br>UUID: b290ad2c-2ed0-4d46-b2fe-12545bf5f31c<br>Ancestors: Collections-ul.932<br><br>- 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.<br><br>=============== Diff against Collections-ul.932 ===============<br><br>Item was changed:<br> ----- Method: SequenceableCollection class>>new:streamContents: (in category 'stream creation') -----<br> new: newSize streamContents: blockWithArg<br> <br> | stream originalContents |<br>+ stream := WriteStream on: (self ofSize: newSize).<br>- stream := WriteStream on: (self new: newSize).<br> blockWithArg value: stream.<br> originalContents := stream originalContents.<br>+ ^originalContents size = stream position<br>+ ifTrue: [ originalContents ]<br>+ ifFalse: [ stream contents ]!<br>- originalContents size = stream position<br>- ifTrue: [ ^originalContents ]<br>- ifFalse: [ ^stream contents ]!<br><br><br></div></blockquote></div>