<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.45">
<TITLE>RE: #Smalltalk: Smalltalk for .NET</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>G'day All,</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>I've been messing about with a smalltalk(ish) compiler I'm writing (in Java) that produces Flash bytecodes.&nbsp; It works pretty well for simple Smalltalk programs, and I've even managed to port the benchmarks for GNUSmalltalk to run on it.&nbsp; I was quite surprised at how slow the Flash MX VM is.</FONT></P>

<P><FONT SIZE=2>The following is the result of the benchmarks run 10 times</FONT>
</P>

<P><FONT SIZE=2>386996 bytecodes/sec; 11652 sends/sec </FONT>
<BR><FONT SIZE=2>397140 bytecodes/sec; 9547 sends/sec </FONT>
<BR><FONT SIZE=2>385356 bytecodes/sec; 8983 sends/sec </FONT>
<BR><FONT SIZE=2>343406 bytecodes/sec; 9629 sends/sec </FONT>
<BR><FONT SIZE=2>384615 bytecodes/sec; 11246 sends/sec </FONT>
<BR><FONT SIZE=2>410172 bytecodes/sec; 11573 sends/sec </FONT>
<BR><FONT SIZE=2>383288 bytecodes/sec; 9684 sends/sec </FONT>
<BR><FONT SIZE=2>389408 bytecodes/sec; 8836 sends/sec </FONT>
<BR><FONT SIZE=2>404203 bytecodes/sec; 9712 sends/sec </FONT>
<BR><FONT SIZE=2>400480 bytecodes/sec; 11264 sends/sec </FONT>
</P>

<P><FONT SIZE=2>These were produced with the Flash MX player on an Apple 1Ghz TiBook with 1 GB of RAM and as you can see I have a LONG way to go before I can rival Squeak on speed ;)</FONT></P>

<P><FONT SIZE=2>And the following is the code that produced the results</FONT>
</P>

<P><FONT SIZE=2>Object subclass: #Benchmarks </FONT>
<BR><FONT SIZE=2>instanceVariableNames: '' </FONT>
<BR><FONT SIZE=2>classVariableNames: '' </FONT>
<BR><FONT SIZE=2>poolDictionaries: '' </FONT>
<BR><FONT SIZE=2>category: nil ! </FONT>
</P>

<P><FONT SIZE=2>!Benchmarks methodsFor: 'benchmarks'! </FONT>
</P>

<P><FONT SIZE=2>tinyBenchmarks: value </FONT>
<BR><FONT SIZE=2>&quot;Report the results of running the two tiny Squeak benchmarks. </FONT>
</P>

<P><FONT SIZE=2>The following table lists results for various Smalltalks on a </FONT>
<BR><FONT SIZE=2>300 MHz PentiumII PC. Take these results with a grain of salt </FONT>
<BR><FONT SIZE=2>and read these notes: </FONT>
</P>

<P><FONT SIZE=2>Notes: </FONT>
<BR><FONT SIZE=2>a) An object table does hinder performance of course, but not </FONT>
<BR><FONT SIZE=2>that much. VisualWorks is still 25% faster than IBM Smalltalk, </FONT>
<BR><FONT SIZE=2>and even 40% in the `send message' benchmark where the object </FONT>
<BR><FONT SIZE=2>table should penalize it more. </FONT>
<BR><FONT SIZE=2>b) Smalltalk MT's sending performance is poor because numbers </FONT>
<BR><FONT SIZE=2>were obtained evaluating the benchmarks from the Transcript, </FONT>
<BR><FONT SIZE=2>which activates a non-optimized build -- creating an indipendent </FONT>
<BR><FONT SIZE=2>executable would bring numbers considerably higher. Not owning </FONT>
<BR><FONT SIZE=2>a copy Smalltalk MT I cannot do that and correct the figures. </FONT>
<BR><FONT SIZE=2>c) I feel that the JIT compiler's performance is encouraging, </FONT>
<BR><FONT SIZE=2>although the current architecture cannot show great improvements </FONT>
<BR><FONT SIZE=2>in the sends benchmark. Adding type inferencing will probably </FONT>
<BR><FONT SIZE=2>shorten the gap with VisualWorks, which is a derivative of the </FONT>
<BR><FONT SIZE=2>original ParcPlace translator! </FONT>
<BR><FONT SIZE=2>d) I know that some values are for obsolete versions of the </FONT>
<BR><FONT SIZE=2>tools. Send updated values if you care. </FONT>
</P>
<BR>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ,--- (B)ytecode interpreter, (J)IT compiler, static (C)ompiler </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; / ,-- Uses (D)irect or (I)ndirect pointers </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; / / </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp; ././.---------------------.---------------------.-----------------. </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp; |B|I| Dolphin Smalltalk&nbsp;&nbsp; | 17.4 Mbytecodes/sec | 1112 Ksends/sec | </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp; |B|I| GST (with GCC 3.0)&nbsp; | 22.4 Mbytecodes/sec | 1080 Ksends/sec | </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp; |J|D| IBM Smalltalk 3.0&nbsp;&nbsp; | 61.9 Mbytecodes/sec | 4224 Ksends/sec | </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp; |J|I| GST (with JIT)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 72.0 Mbytecodes/sec | 2625 Ksends/sec | </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp; |J|I| VisualWorks 5i&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 81.8 Mbytecodes/sec | 5950 Ksends/sec | </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp; |C|?| Smalltalk MT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 128 Mbytecodes/sec&nbsp; | 1076 Ksends/sec | </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp; '-'-----------------------'---------------------'-----------------&quot; </FONT>
</P>

<P><FONT SIZE=2>| t1 t2 r n1 n2 | </FONT>
<BR><FONT SIZE=2>&nbsp; n1 _ 1 bitShift: value. </FONT>
<BR><FONT SIZE=2>&nbsp; [t1 _ Time millisecondsToRun: [ self benchmark:n1 ]. </FONT>
<BR><FONT SIZE=2>&nbsp; t1 &lt; 1000] whileTrue:[ n1 _ n1 * 2 ]. </FONT>
</P>

<P><FONT SIZE=2>&nbsp; n2 _ 12 + value. </FONT>
<BR><FONT SIZE=2>&nbsp; [t2 _ Time millisecondsToRun: [r _ (self benchFib: n2)]. </FONT>
<BR><FONT SIZE=2>&nbsp; t2 &lt; 1000] whileTrue:[ n2 _ n2 + 1 ]. </FONT>
</P>

<P><FONT SIZE=2>&nbsp; ^((n1 * 500000 * 1000) // t1) printString, ' bytecodes/sec; ', </FONT>
<BR><FONT SIZE=2>&nbsp; ((r * 1000) // t2) printString, ' sends/sec'! </FONT>
</P>

<P><FONT SIZE=2>benchFib: value </FONT>
</P>

<P><FONT SIZE=2>&nbsp; &quot;Handy send-heavy benchmark -- result is number of sends: </FONT>
<BR><FONT SIZE=2>&nbsp; (result // seconds to run) = approx calls per second&quot; </FONT>
</P>

<P><FONT SIZE=2>&nbsp; value &lt; 2 </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifTrue: [^1] </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifFalse: [^((self benchFib: (value - 1)) + (self benchFib: (value - 2)) + 1)] </FONT>
<BR><FONT SIZE=2>! </FONT>
</P>

<P><FONT SIZE=2>benchmark: value </FONT>
</P>

<P><FONT SIZE=2>&nbsp; &quot;Handy bytecode-heavy benchmark -- approx 500000 bytecodes per run: </FONT>
<BR><FONT SIZE=2>&nbsp; (500000 * times ran // secs to run) = approx bytecodes per second&quot; </FONT>
<BR><FONT SIZE=2>| size flags prime k count | </FONT>
</P>

<P><FONT SIZE=2>&nbsp; size _ 8190. </FONT>
<BR><FONT SIZE=2>&nbsp; flags _ Array new: size. </FONT>
</P>

<P><FONT SIZE=2>&nbsp; value timesRepeat: [ </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; count _ 0. </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 to: size do: </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [:i | flags at: i put: true ].&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 to: size do: </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [:i | (flags at: i) ifTrue: </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [prime _ i+1. </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; k _ i + prime. </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [k &lt;= size] whileTrue: </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [flags at: k put: false. </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; k _ k + prime]. </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; count _ count + 1]]].&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
</P>

<P><FONT SIZE=2>&nbsp; ^count </FONT>
</P>

<P><FONT SIZE=2>! ! </FONT>
</P>

<P><FONT SIZE=2>|b iter t1| </FONT>
<BR><FONT SIZE=2>b := Benchmarks new. </FONT>
<BR><FONT SIZE=2>iter := 1. </FONT>
<BR><FONT SIZE=2>(b tinyBenchmarks: iter) printNl! </FONT>
</P>
<BR>

<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Aaron J Reichow [<A HREF="mailto:reic0024@d.umn.edu">mailto:reic0024@d.umn.edu</A>]</FONT>
<BR><FONT SIZE=2>Sent: Wednesday, 23 April 2003 10:15 AM</FONT>
<BR><FONT SIZE=2>To: squeak list</FONT>
<BR><FONT SIZE=2>Subject: #Smalltalk: Smalltalk for .NET</FONT>
</P>
<BR>

<P><FONT SIZE=2>Someone, uh, handed me this link... It may interest some of us:</FONT>
</P>

<P><FONT SIZE=2><A HREF="http://www.refactory.com/Software/SharpSmalltalk/index.html" TARGET="_blank">http://www.refactory.com/Software/SharpSmalltalk/index.html</A></FONT>
</P>

<P><FONT SIZE=2>Regards,</FONT>
<BR><FONT SIZE=2>Aaron</FONT>
</P>

<P><FONT SIZE=2>&nbsp; Aaron Reichow&nbsp; ::&nbsp; UMD ACM Pres&nbsp; ::&nbsp; <A HREF="http://www.d.umn.edu/~reic0024/" TARGET="_blank">http://www.d.umn.edu/~reic0024/</A></FONT>
<BR><FONT SIZE=2>&nbsp; &quot;corporation, n: an ingenious device for obtaining individual profit</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; without individual responsibility.&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :: ambrose bierce</FONT>
</P>

</BODY>
</HTML>