<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Cute benchmark :)</div><div><br></div><div>Some thoughts:</div><div><br></div><div>Try closing the desktop and see how much of a speedup you get (i.e. 'desktop close', then run from the terminal). Morphic in Self is nowhere near as optimised as it could be. </div><div><br></div><div>This is small integer stuff on both Self and Pharo, so I guess much of the time is spent in primitives?</div><div><br></div><div>In fact generally speaking, this code shows Self running many more messages than Pharo, as ‘count:= count + 1’ in Pharo sends very few messages.</div><div><br></div><div>(Is whileTrue in Pharo a true message send or is it byte code like ifTrue?)</div><div><br></div><div>Are ‘time’ and ‘timeToRun’ measuring the same thing?</div><div><br></div><div>Is this with Cog or the standard Squeak vm?</div><div><br></div><div>Russell</div><div style="font-size: 16px;"><br></div><br><div><div>On 22 Dec 2014, at 2:48 pm, Chris Double <a href="mailto:chris.double@double.co.nz">chris.double@double.co.nz</a> [self-interest] <<a href="mailto:self-interest@yahoogroups.com">self-interest@yahoogroups.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><div id="ygrp-mlmsg" style="font-size: 13px; font-family: Arial, helvetica, clean, sans-serif; position: relative;"><div id="ygrp-msg" style="line-height: 1.22em; z-index: 1;"><div id="ygrp-text" style="line-height: 1.22em; font-family: Georgia;"><p style="line-height: 1.22em; margin: 0px 0px 1em;">On Mon, Dec 22, 2014 at 4:41 PM, Chris Double <<a href="mailto:chris.double@double.co.nz" style="line-height: 1.22em; font-family: Verdana;">chris.double@double.co.nz</a>> wrote:<br style="line-height: 1.22em;">> I don't know what I was doing wrong before but now when I run it I get<br style="line-height: 1.22em;">> 640ms for the Self version. That's only 2.5 or so slower than Pharo<br style="line-height: 1.22em;">> which isn't too shabby.<br style="line-height: 1.22em;"><br style="line-height: 1.22em;">Aha! What was causing the time difference is if I run it in 'time'<br style="line-height: 1.22em;">first then I get the slow time. If I run it outside of 'time' first<br style="line-height: 1.22em;">then I get the faster time next time I run it within 'time'. Something<br style="line-height: 1.22em;">preventing some optimized compilation in 'time'?<br style="line-height: 1.22em;"><br style="line-height: 1.22em;">"Self 31" _AddSlots: (| doSomething = ( ^self ). test4 = ( |n <-0| [<br style="line-height: 1.22em;">n < 100000000 ] whileTrue: [ doSomething. n: n + 1] ) |)<br style="line-height: 1.22em;">shell<br style="line-height: 1.22em;">"Self 32" [ test4 ] time.<br style="line-height: 1.22em;">2870<br style="line-height: 1.22em;">"Self 33" [ test4 ] time.<br style="line-height: 1.22em;">2898<br style="line-height: 1.22em;">"Self 34" test4.<br style="line-height: 1.22em;">nil<br style="line-height: 1.22em;">"Self 35" [ test4 ] time.<br style="line-height: 1.22em;">635<br style="line-height: 1.22em;"><br style="line-height: 1.22em;">--<span class="Apple-converted-space"> </span><br style="line-height: 1.22em;"><a href="http://bluishcoder.co.nz/" style="line-height: 1.22em; font-family: Verdana;">http://bluishcoder.co.nz</a><br style="line-height: 1.22em;"></p></div><div style="line-height: 1.22em; color: rgb(255, 255, 255); height: 0px;"></div></div></blockquote></div><br></body></html>