<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-ligatures:standardcontextual;
mso-fareast-language:EN-US;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-ligatures:standardcontextual;
mso-fareast-language:EN-US;}
span.E-MailFormatvorlage17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1180237957;
mso-list-type:hybrid;
mso-list-template-ids:563479256 67567631 67567641 67567643 67567631 67567641 67567643 67567631 67567641 67567643;}
@list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=DE link="#0563C1" vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal>Hi,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>I was going to complain that #new: on OrderedCollection was removed.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>I thought that it is common wisdom that #new: is a very important optimization when allocating OrderedCollections, especially big ones.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Therefore, I measured the differences with the following script:<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'>| time time1 time2 |<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'>(0 to: 100000 by: 1000) collect: [:size |<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> time := time1 := time2 := 0.<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> 1000 timesRepeat: [<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> time := time + (Time microsecondsToRun: [<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> | list |<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> list := OrderedCollection new.<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> 1 to: size do: [:i | list add: i]])].<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> time1 := time / 1000.<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> time := 0.<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> 1000 timesRepeat: [<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> time := time + (Time microsecondsToRun: [<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> | list |<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> list := OrderedCollection new: size.<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> 1 to: size do: [:i | list add: i]])].<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> time2 := time / 1000.<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> Array with: size with: time1 with: time2]</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>I ran the script with the current Cuis 6.3, Pharo 10, Squeak 6.0 and VW 9.3.1.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>The results are in the attached file from which I created the charts below with Excel.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>The size of the created collections are on the x-axis, while the y-axis shows the microseconds.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>The results are interesting!<o:p></o:p></span></p><ol style='margin-top:0cm' start=1 type=1><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'><span lang=EN-US>As expected, VW new: is the fastest and grows linear with the collection size.<o:p></o:p></span></li><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'><span lang=EN-US>As expected, #new is slower than #new: (except for Cuis – more below)<o:p></o:p></span></li><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'><span lang=EN-US>There are certain threshold sizes from which on the creation is consistently slower (look at 40,000 and 82,000 for #new:)<o:p></o:p></span></li><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'><span lang=EN-US>Surprising is the slowness of Pharo(?)<o:p></o:p></span></li></ol><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><img width=1264 height=737 style='width:13.1666in;height:7.677in' id="Diagramm_x0020_1" src="cid:image002.png@01DA6DA2.18BD7550"><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>Extremely surprising is Cuis. The next chart shows just Cuis and Squeak to spread the scale a bit.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In Cuis, both methods have about the same performance and are growing linear with the size!!!<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>How is this possible? What is the magic? Or is the measurement wrong? <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>I am quite impressed.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>And I am not going to complain about the missing #new: </span><span lang=EN-US style='font-family:Wingdings'>J</span><span lang=EN-US>.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Happy hacking,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Christian<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><img width=1264 height=737 style='width:13.1666in;height:7.677in' id="Diagramm_x0020_2" src="cid:image006.png@01DA6DA2.18BD7550"><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>