« Reading List: Children's Crusade | Main | Reading List: Flash Boys »

Sunday, May 4, 2014

Floating Point Benchmark: Algol 68 Added

I have posted an update to my trigonometry-intense floating point benchmark which adds Algol 68 to the list of languages in which the benchmark is implemented. A new release of the benchmark collection including Algol 68 is now available for downloading.

1968 was a year when all of the extremes were tested. There were riots, revolutions, invasions of countries trying to throw off the yoke of tyranny, and humans orbiting the Moon, sending back pictures of the home planet rising above its alien horizon. It was only fitting that this year should also herald the advent of the most over-the-top programming language of all time: Algol 68. Algol 68 was conceived to be the successor to ALGOL 60, originally imagined more as a way of formally specifying algorithms than a programming language, but later implemented with extensions on a variety of computers.

Algol 68 is an object lesson of what happens when academics are allowed to run riot. What started out as an attempt to create a practical programming language turned into a scholastic exercise whose initial language definition was incomprehensible to almost everybody and involved a language definition which could produce an infinite number of productions. Several members of the committee working on the language resigned in disgust and produced a minority report savaging the design of the language, which was suppressed by the standards organisation promoting Algol 68.

This was a tragedy on many levels. Algol 68 was, for its time, vastly superior to all alternatives. If those defining and promoting it had been humble enough to express its definition in a form comprehensible by actual programmers and encourage its adoption in industry, by the mid 1970s we would have been using a programming language which was portable among architectures, safe from most of the vulnerabilities of languages like C, equipped with modern memory management (heap and stack allocation, garbage collection), and with support for parallel processes and synchronisation. Algol 68 did not include subsequently-developed concepts such as object-oriented programming, but these could have been added to the existing language far more straightforwardly than the kludge ziggurat which is C++.

When you look at C, Pascal, Modula, Java, and other languages, you can see the legacy of Algol 68. While the language was stillborn, its concepts live unto this day.

The relative performance of the various language implementations (with C taken as 1) is as follows. All language implementations of the benchmark listed below produced identical results to the last (11th) decimal place.

Language Relative
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
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
Haskell 1.223 GHC 7.4.1-O2 -funbox-strict-fields, Linux
Ada 1.401 GNAT/GCC 3.4.4 -O3, Linux
Go 1.481 Go version go1.1.1 linux/amd64, Linux
Lisp 7.41
GNU Common Lisp 2.6.7, Compiled, Linux
GNU Common Lisp 2.6.7, Interpreted
Smalltalk 7.59 GNU Smalltalk 2.3.5, Linux
Forth 9.92 Gforth 0.7.0, Linux
COBOL 12.5
Micro Focus Visual COBOL 2010, Windows 7
Fixed decimal instead of computational-2
Algol 68 15.2 Algol 68 Genie 2.4.1 -O3, 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
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

The performance figure for Algol 68 should not be taken as representative of the language. The Algol 68 Genie system I used was developed with the goal of being a reference implementation of the language and a teaching tool. It is a compiler/interpreter with extensive run-time checking, and was not implemented with efficiency as a primary goal. There is no reason to believe that an Algol 68 compiler developed with resources comparable to modern compilers for other languages would not be competitive in performance.

Posted at May 4, 2014 23:10