#Smalltalk: Smalltalk for .NET

Daniel Parnell daniel.parnell at oz.quest.com
Wed Apr 23 02:13:29 UTC 2003


G'day All,

	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.

The following is the result of the benchmarks run 10 times

386996 bytecodes/sec; 11652 sends/sec 
397140 bytecodes/sec; 9547 sends/sec 
385356 bytecodes/sec; 8983 sends/sec 
343406 bytecodes/sec; 9629 sends/sec 
384615 bytecodes/sec; 11246 sends/sec 
410172 bytecodes/sec; 11573 sends/sec 
383288 bytecodes/sec; 9684 sends/sec 
389408 bytecodes/sec; 8836 sends/sec 
404203 bytecodes/sec; 9712 sends/sec 
400480 bytecodes/sec; 11264 sends/sec 

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 ;)

And the following is the code that produced the results

Object subclass: #Benchmarks 
instanceVariableNames: '' 
classVariableNames: '' 
poolDictionaries: '' 
category: nil ! 

!Benchmarks methodsFor: 'benchmarks'! 

tinyBenchmarks: value 
"Report the results of running the two tiny Squeak benchmarks. 

The following table lists results for various Smalltalks on a 
300 MHz PentiumII PC. Take these results with a grain of salt 
and read these notes: 

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


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

| t1 t2 r n1 n2 | 
  n1 _ 1 bitShift: value. 
  [t1 _ Time millisecondsToRun: [ self benchmark:n1 ]. 
  t1 < 1000] whileTrue:[ n1 _ n1 * 2 ]. 

  n2 _ 12 + value. 
  [t2 _ Time millisecondsToRun: [r _ (self benchFib: n2)]. 
  t2 < 1000] whileTrue:[ n2 _ n2 + 1 ]. 

  ^((n1 * 500000 * 1000) // t1) printString, ' bytecodes/sec; ', 
  ((r * 1000) // t2) printString, ' sends/sec'! 

benchFib: value 

  "Handy send-heavy benchmark -- result is number of sends: 
  (result // seconds to run) = approx calls per second" 

  value < 2 
        ifTrue: [^1] 
        ifFalse: [^((self benchFib: (value - 1)) + (self benchFib: (value -
2)) + 1)] 
! 

benchmark: value 

  "Handy bytecode-heavy benchmark -- approx 500000 bytecodes per run: 
  (500000 * times ran // secs to run) = approx bytecodes per second" 
| size flags prime k count | 

  size _ 8190. 
  flags _ Array new: size. 

  value timesRepeat: [ 
        count _ 0. 
        1 to: size do: 
        [:i | flags at: i put: true ].     

        1 to: size do: 
        [:i | (flags at: i) ifTrue: 
                [prime _ i+1. 
                k _ i + prime. 
                [k <= size] whileTrue: 
                [flags at: k put: false. 
                k _ k + prime]. 
                count _ count + 1]]].                

  ^count 

! ! 

|b iter t1| 
b := Benchmarks new. 
iter := 1. 
(b tinyBenchmarks: iter) printNl! 


-----Original Message-----
From: Aaron J Reichow [mailto:reic0024 at d.umn.edu]
Sent: Wednesday, 23 April 2003 10:15 AM
To: squeak list
Subject: #Smalltalk: Smalltalk for .NET


Someone, uh, handed me this link... It may interest some of us:

http://www.refactory.com/Software/SharpSmalltalk/index.html

Regards,
Aaron

  Aaron Reichow  ::  UMD ACM Pres  ::  http://www.d.umn.edu/~reic0024/
  "corporation, n: an ingenious device for obtaining individual profit
          without individual responsibility."        :: ambrose bierce

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030423/82153747/attachment.htm


More information about the Squeak-dev mailing list