PLEASE CHOOSE THE UP-TO-DATE MEASUREMENTS INSTEAD OF THESE! (Read the FAQ!) |
Compare the performance of Smalltalk GNU programs against some other language implementation.
For more information about the Smalltalk implementation we measured see ↓ about Smalltalk GNU.
| 1/2 1/3 1/4 Smalltalk GNU is better | ||||
|---|---|---|---|---|
| Programs | Time | Memory Use | Source Size | Reduced N |
| chameneos-redux | ||||
| binary-trees | ||||
| recursive | 1/5 | 7 | ± | 7 |
| nsieve | 1/2 | 1/3 | ± | |
| fasta | 1/2 | 2 | ± | |
| fannkuch | 1/2 | 2 | 2 | 10 |
| spectral-norm | 1/2 | 2 | ± | |
| n-body | ± | 4 | ± | |
| mandelbrot | ± | 2 | 2 | |
| nsieve-bits | ± | 3 | 3 | |
| partial-sums | ± | 2 | ± | |
| regex-dna | 4 | 8 | ± | |
| k-nucleotide | 10 | ± | 3 | |
| pidigits | 20 | 151 | 2 | |
| sum-file | 29 | ± | 2 | |
| reverse-complement | 34 | ± | 3 | |
± look at the measurements
| Program & Logs | CPU secs | Memory KB | Size B | Elapsed secs | ~ CPU Load |
|---|---|---|---|---|---|
| recursive N = 7 reduced workload | |||||
| Smalltalk GNU | 6.74 | 16,052 | 510 | ||
| Perl #2 | 31.60 | 2,144 | 380 | ||
| nsieve | |||||
| Smalltalk GNU | 25.73 | 76,568 | 370 | ||
| Perl #2 | 60.70 | 242,316 | 290 | ||
| fasta | |||||
| Smalltalk GNU #2 | 435.45 | 6,784 | 1298 | ||
| Perl #4 | 850.67 | 3,156 | 934 | ||
| fannkuch N = 10 reduced workload | |||||
| Smalltalk GNU | 33.64 | 7,616 | 777 | ||
| Perl | 58.98 | 3,144 | 348 | ||
| spectral-norm | |||||
| Smalltalk GNU | 2,547.89 | 28,392 | 476 | ||
| Perl #2 | 3,943.63 | 18,536 | 334 | ||
| n-body | |||||
| Smalltalk GNU | 1,551.58 | 6,912 | 1657 | ||
| Perl | 1,567.73 | 1,904 | 1140 | ||
| mandelbrot | |||||
| Smalltalk GNU #2 | 415.84 | 6,188 | 473 | ||
| Perl #2 | 382.65 | 3,388 | 311 | ||
| nsieve-bits | |||||
| Smalltalk GNU | 120.61 | 11,108 | 754 | ||
| Perl | 93.55 | 4,024 | 253 | ||
| partial-sums | |||||
| Smalltalk GNU | 19.01 | 6,452 | 558 | ||
| Perl #3 | 14.23 | 3,156 | 389 | ||
| regex-dna | |||||
| Smalltalk GNU | 61.26 | 201,988 | 502 | ||
| Perl #2 | 13.66 | 25,048 | 449 | ||
| k-nucleotide | |||||
| Smalltalk GNU | 272.91 | 52,904 | 959 | ||
| Perl #2 | 27.54 | 42,836 | 359 | ||
| pidigits | |||||
| Smalltalk GNU | 125.15 | 475,396 | 905 | ||
| Perl #2 | 6.21 | 3,144 | 385 | ||
| sum-file | |||||
| Smalltalk GNU #2 | 444.22 | 18,212 | 186 | ||
| Perl | 15.55 | 14,916 | 84 | ||
| reverse-complement | |||||
| Smalltalk GNU | 67.64 | 48,904 | 750 | ||
| Perl #2 | 1.99 | 38,356 | 298 | ||
"Design Principles Behind Smalltalk" by Daniel Ingalls
GNU Smalltalk version 2.3.6
Home Page: GNU Smalltalk : The Smalltalk for those who can type
Download: Downloading GNU Smalltalk
--enable-jit was not available for this build
We've made the Smalltalk code a little more generic by abstracting out these implementation specific details, these are read from the command line before each script:
Object subclass: #Tests instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Shootout'! !Tests class methodsFor: 'platform'! arg ^Smalltalk arguments first asInteger! ! !Tests class methodsFor: 'platform'! stdin ^FileStream stdin! ! !Tests class methodsFor: 'platform'! stdinSpecial ^self stdin bufferSize: 4096! ! !Tests class methodsFor: 'platform'! stdout ^FileStream stdout! ! !Tests class methodsFor: 'platform'! stdoutSpecial ^self stdout bufferSize: 4096! ! !Stream methodsFor: 'platform'! print: number digits: decimalPlaces | n s | n := 0.5d0 * (10 raisedToInteger: decimalPlaces negated). s := ((number sign < 0) ifTrue: [number - n] ifFalse: [number + n]) printString. self nextPutAll: (s copyFrom: 1 to: (s indexOf: $.) + decimalPlaces)! ! !Stream methodsFor: 'platform'! print: number paddedTo: width | s | s := number printString. self nextPutAll: (String new: (width - s size) withAll: $ ), s! ! !Integer methodsFor: 'platform'! asFloatD ^self asFloat! !