« October 10, 2007 |
Main
| October 13, 2007 »
Friday, October 12, 2007
Floating Point Benchmark: Smalltalk Language Added
I have posted an update to my trigonometry-intense
floating point benchmark which adds Smalltalk to the list of languages in which the benchmark is implemented. A new release of the
benchmark collection including Smalltalk is now available for downloading.
The Smalltalk benchmark was developed and tested on
GNU Smalltalk version 2.3.5 on Fedora 7 Linux; the relative performance of the various language implementations (with C taken as 1) is as follows. All benchmarks were run on the same Dell Inspiron 9100 Pentium 4 machine. All implementations of the benchmark listed below produced identical results to the last (11th) decimal place.
Language |
Relative Time |
Details |
C |
1 |
GCC 3.2.3 -O3, Linux |
Visual Basic .NET |
0.866 |
All optimisations, Windows XP |
FORTRAN |
1.008 |
GNU Fortran (g77) 3.2.3 -O3, Linux |
Pascal |
1.027
1.077 |
Free Pascal 2.2.0 -O3, Linux
GNU Pascal 2.1 (GCC 2.95.2) -O3, Linux |
Java |
1.121 |
Sun JDK 1.5.0_04-b05, Linux |
Visual Basic 6 |
1.132 |
All optimisations, Windows XP |
Ada |
1.401 |
GNAT/GCC 3.4.4 -O3, Linux |
Lisp |
7.41
19.8 |
GNU Common Lisp 2.6.7, Compiled, Linux
GNU Common Lisp 2.6.7, Interpreted |
Smalltalk |
7.59 |
GNU Smalltalk 2.3.5, Linux |
Python |
17.6 |
Python 2.3.3 -OO, Linux |
Perl |
23.6 |
Perl v5.8.0, Linux |
Ruby |
26.1 |
Ruby 1.8.3, Linux |
JavaScript |
27.6
39.1
46.9 |
Opera 8.0, Linux
Internet Explorer 6.0.2900, Windows XP
Mozilla Firefox 1.0.6, Linux |
QBasic |
148.3 |
MS-DOS QBasic 1.1, Windows XP Console |
Smalltalk is a somewhat eccentric language well known for attracting eccentric people. It wouldn't surprise me in the least if this program required modifications in order to run on other Smalltalk implementations, or if members of the Smalltalk priesthood should find my straightforward procedural code abhorrent in some regard.
For a dynamically-typed pure object-oriented language, the performance delivered by GNU Smalltalk is impressive. The benchmark ran more than twice as fast as Python and 3.4 times the speed of Ruby—“modern” languages often considered descended from Smalltalk. GNU Common Lisp in compiled mode just edged out GNU Smalltalk by about 2%.
Smalltalk (or at least the base implementation provided by GNU Smalltalk: I have not investigated add-on packages) is the only one of the fourteen languages in which the floating point benchmark has been implemented to date which provides no facility for formatting floating-point values with a specified field size and precision. In order to create output compatible with the other implementations of the benchmark for accuracy validation, I had to write my own toDecimal:places: extension to the Number class to provide fixed-format decimal output of floating-point values. This method isn't completely general, but if you find yourself with the need to output rounded decimal floating point values in a tabular form from Smalltalk, it may be a useful starting point.
I tried to load the program into
Squeak 3.9-8, but as my tolerance for seventeen line error messages which never cite the offending line in the program you're trying to load is rather low these days, I quickly said, “enough of that”.
Posted at
16:32