<!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> <FONT SIZE=2>I've been messing about with a smalltalk(ish) compiler I'm writing (in Java) that produces Flash bytecodes. It works pretty well for simple Smalltalk programs, and I've even managed to port the benchmarks for GNUSmalltalk to run on it. 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>"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> ,--- (B)ytecode interpreter, (J)IT compiler, static (C)ompiler </FONT>
<BR><FONT SIZE=2> / ,-- Uses (D)irect or (I)ndirect pointers </FONT>
<BR><FONT SIZE=2> / / </FONT>
<BR><FONT SIZE=2> ././.---------------------.---------------------.-----------------. </FONT>
<BR><FONT SIZE=2> |B|I| Dolphin Smalltalk | 17.4 Mbytecodes/sec | 1112 Ksends/sec | </FONT>
<BR><FONT SIZE=2> |B|I| GST (with GCC 3.0) | 22.4 Mbytecodes/sec | 1080 Ksends/sec | </FONT>
<BR><FONT SIZE=2> |J|D| IBM Smalltalk 3.0 | 61.9 Mbytecodes/sec | 4224 Ksends/sec | </FONT>
<BR><FONT SIZE=2> |J|I| GST (with JIT) | 72.0 Mbytecodes/sec | 2625 Ksends/sec | </FONT>
<BR><FONT SIZE=2> |J|I| VisualWorks 5i | 81.8 Mbytecodes/sec | 5950 Ksends/sec | </FONT>
<BR><FONT SIZE=2> |C|?| Smalltalk MT | 128 Mbytecodes/sec | 1076 Ksends/sec | </FONT>
<BR><FONT SIZE=2> '-'-----------------------'---------------------'-----------------" </FONT>
</P>
<P><FONT SIZE=2>| t1 t2 r n1 n2 | </FONT>
<BR><FONT SIZE=2> n1 _ 1 bitShift: value. </FONT>
<BR><FONT SIZE=2> [t1 _ Time millisecondsToRun: [ self benchmark:n1 ]. </FONT>
<BR><FONT SIZE=2> t1 < 1000] whileTrue:[ n1 _ n1 * 2 ]. </FONT>
</P>
<P><FONT SIZE=2> n2 _ 12 + value. </FONT>
<BR><FONT SIZE=2> [t2 _ Time millisecondsToRun: [r _ (self benchFib: n2)]. </FONT>
<BR><FONT SIZE=2> t2 < 1000] whileTrue:[ n2 _ n2 + 1 ]. </FONT>
</P>
<P><FONT SIZE=2> ^((n1 * 500000 * 1000) // t1) printString, ' bytecodes/sec; ', </FONT>
<BR><FONT SIZE=2> ((r * 1000) // t2) printString, ' sends/sec'! </FONT>
</P>
<P><FONT SIZE=2>benchFib: value </FONT>
</P>
<P><FONT SIZE=2> "Handy send-heavy benchmark -- result is number of sends: </FONT>
<BR><FONT SIZE=2> (result // seconds to run) = approx calls per second" </FONT>
</P>
<P><FONT SIZE=2> value < 2 </FONT>
<BR><FONT SIZE=2> ifTrue: [^1] </FONT>
<BR><FONT SIZE=2> 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> "Handy bytecode-heavy benchmark -- approx 500000 bytecodes per run: </FONT>
<BR><FONT SIZE=2> (500000 * times ran // secs to run) = approx bytecodes per second" </FONT>
<BR><FONT SIZE=2>| size flags prime k count | </FONT>
</P>
<P><FONT SIZE=2> size _ 8190. </FONT>
<BR><FONT SIZE=2> flags _ Array new: size. </FONT>
</P>
<P><FONT SIZE=2> value timesRepeat: [ </FONT>
<BR><FONT SIZE=2> count _ 0. </FONT>
<BR><FONT SIZE=2> 1 to: size do: </FONT>
<BR><FONT SIZE=2> [:i | flags at: i put: true ]. </FONT>
</P>
<P><FONT SIZE=2> 1 to: size do: </FONT>
<BR><FONT SIZE=2> [:i | (flags at: i) ifTrue: </FONT>
<BR><FONT SIZE=2> [prime _ i+1. </FONT>
<BR><FONT SIZE=2> k _ i + prime. </FONT>
<BR><FONT SIZE=2> [k <= size] whileTrue: </FONT>
<BR><FONT SIZE=2> [flags at: k put: false. </FONT>
<BR><FONT SIZE=2> k _ k + prime]. </FONT>
<BR><FONT SIZE=2> count _ count + 1]]]. </FONT>
</P>
<P><FONT SIZE=2> ^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> Aaron Reichow :: UMD ACM Pres :: <A HREF="http://www.d.umn.edu/~reic0024/" TARGET="_blank">http://www.d.umn.edu/~reic0024/</A></FONT>
<BR><FONT SIZE=2> "corporation, n: an ingenious device for obtaining individual profit</FONT>
<BR><FONT SIZE=2> without individual responsibility." :: ambrose bierce</FONT>
</P>
</BODY>
</HTML>