tinyBenchmarks on PocketSmalltalk [ was Re: Interesting new target with Palm OS]

John Clonts jclonts at mastnet.net
Mon Oct 23 17:27:30 UTC 2000


Jay Carlson wrote:
> 
> Aaron J Reichow writes:
> 
> > > Seriously, give me a benchmark, and we'll compare pocketsmalltalk.com's
> > > offering to the Helio running squeak.
> 
> Of course, after actually reading up on the pocketsmalltalk stuff, I don't
> think it'll be so obvious who'll win.
> 
> > How about tinyBenchmark?  It should port pretty easily.  In the Squeak
> > image, instance method on Integer.
> 
> OK.  First item in the "do..." menu in shrink4.image is tinyBenchmark now
> :-)
> 
> ~1,480,000 bytecodes/sec
> ~41,500 sends/sec
> 
> So that's 10-20 times slower than the P2/300, and in the same speed class as
> a 25MHz SPARCstation IPX.
> 

Ok, heres what I get on my Palm IIIe (Palm OS 3.1):
   ~17,500 bytecodes/sec
   ~1,260 sends/sec

Cheers,
John



package benchmarks.st:


!"Pocket Smalltalk fileout - 12:20:33 PM, Monday, October 23, 2000"!


!Integer methodsFor: 'benchmarks'!

benchFib

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


!Integer methodsFor: 'benchmarks'!


tinyBenchmarks
	"Report the results of running the two tiny Squeak benchmarks.
	ar 9/10/1999: Adjusted to run at least 1 sec to get more stable
results"
	"0 tinyBenchmarks"
	"On a 292 MHz G3 Mac: 22727272 bytecodes/sec; 984169 sends/sec"
	"On a 400 MHz PII/Win98:  18028169 bytecodes/sec; 1081272 sends/sec"
	| t1 t2 r n1 n2 beg|

	n1 := 1.
	[t1 := Time milliSecondsToRun: [n1 benchmark].
	t1 < 1000] whileTrue:[n1 := n1 * 2]. 
	"Note: #benchmark's runtime is about O(n)"

	n2 := 10.
	[t2 := Time milliSecondsToRun: [r := n2 benchFib].
	t2 < 1000] whileTrue:[n2 := n2 + 1]. 
	"Note: #benchFib's runtime is about O(k^n),
		where k is the golden number = (1 + 5 sqrt) / 2 = 1.618...."

    "j.clonts note: scaled from 500000 downto 62500 for
Pocketsmalltalk/Palm"
	^ ((n1 * 62500 * 1000) // t1) printString, ' bytecodes/sec; ', 
	  ((r * 1000) // t2) printString, ' sends/sec'! !


!Integer methodsFor: 'benchmarks'!

benchmark  "Handy bytecode-heavy benchmark"
    "(62500 // time to run) = approx bytecodes per second"
    "17500 on a Palm IIIe"
    | size flags prime k count |
    size := 1024.   "scaled down by j.clonts from 8190"

    1 to: self do:
        [:iter |
        count := 0.
  
        flags := Array new: size. 
        flags atAllPut: true.  "note atAllPut: returns element"
        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
! !





More information about the Squeak-dev mailing list