<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><blockquote type="cite" class=""><div class="">On 11 Apr 2016, at 20:47, Taras Zakharko &lt;<a href="mailto:taras.zakharko@uzh.ch" class="">taras.zakharko@uzh.ch</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><span class="" style="font-size: inherit; float: none; display: inline !important;">the question is what is faster: {self[0] &lt; self[1]} or {$1.0 &lt; $1.1}</span></div></blockquote></div><br class=""><div class="">Yes, you are right that this is in fact not obvious!&nbsp;</div><div class=""><br class=""></div><div class="">I’ve just measured and, though my implementation is faster, it’s advantage only grows linearly with the length of the array:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;" class=""><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;">        </span></span><br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);">let</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp;a = (</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);">1</span><span class="" style="font-variant-ligatures: no-common-ligatures;">...</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);">100_000</span><span class="" style="font-variant-ligatures: no-common-ligatures;">).</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(143, 121, 58);">shuffled</span></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;" class=""><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;">        </span></span><br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp;testPerformanceOf_orderSequence() {</span></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; color: rgb(145, 84, 15);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space: pre;">                </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);">self</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);">.</span><span class="" style="font-variant-ligatures: no-common-ligatures;">measureBlock</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);">&nbsp;{</span></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; color: rgb(145, 84, 15);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space: pre;">                        </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);">self</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);">.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(143, 121, 58);">a</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);">.</span><span class="" style="font-variant-ligatures: no-common-ligatures;">orderSequence</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);">(&lt;)&nbsp;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(203, 203, 203);">// 0.464 sec</span></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;">                </span>}</span></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;">        </span>}</span></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;" class=""><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;">        </span></span><br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp;testPerformanceOf_orderCollection() {</span></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; color: rgb(145, 84, 15);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space: pre;">                </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);">self</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);">.</span><span class="" style="font-variant-ligatures: no-common-ligatures;">measureBlock</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);">&nbsp;{</span></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; color: rgb(145, 84, 15);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space: pre;">                        </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);">self</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);">.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(143, 121, 58);">a</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);">.</span><span class="" style="font-variant-ligatures: no-common-ligatures;">orderCollection</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);">(&lt;)&nbsp;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(203, 203, 203);">// 1.067 sec</span></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;">                </span>}</span></div><div class="" style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';"><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;">        </span>}</span></div></div><div class=""><br class=""></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;">It remains only twice as fast for 10,000 and 1000 elements (below that is the margin of error).</span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;"><br class=""></span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;">milos</span></div></div></body></html>