« May 5, 2014 | Main | May 10, 2014 »

Friday, May 9, 2014

Floating Point Benchmark: ALGOL 60 Added

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

ALGOL 60 was one of the first languages designed to be machine-independent, a standard produced by an committee unaffiliated with any computer manufacturer. ALGOL 60 was also intended to be a means of formally specifying and publishing algorithms in academic journals. Due to this goal, and because at the time input/output (I/O) was considered highly machine-specific, the language specification included no I/O facilities at all. This meant that in order to use it as a programming language, the ALGOL 60 standard had to be extended to include I/O. Each implementation tended to do this in its own way, meaning that while the core language was portable, actual programs could not be moved from one compiler to another without modification. This, along with what was considered the complexity of some aspects of the language, in particular “call by name” procedure parameters, hindered adoption of the language in industry. Further, vendors had already invested heavily in improving the performance of ALGOL 60's principal competitor, FORTRAN, and consequently FORTRAN compilers usually out-performed ALGOL 60. In computationally intense scientific and engineering work, with the slow and costly computers of the time, this gave FORTRAN the edge.

Still, if you look at almost any modern computer language, you'll see the legacy of ALGOL 60. Its generality, machine-independence, support for nested procedures, recursion, and stack-based call structure have become commonplace. Although the term “structured programming” was not invented until years later, ALGOL 60 contained most of the constructs it required.

Programming today in ALGOL 60 is an excellent experience in retrocomputing. While the language was extremely (and, to some, frighteningly) advanced for its time, there are some lacunæ which are striking to the contemporary programmer. Most obvious is the lack of a standard I/O system, but also there is no way to initialise variables (a feature FORTRAN had) except by declaring them and then assigning them values at run time. One cannot define named constants: you either use a literal or declare it as a variable and initialise it (and then someone reading the program can't be sure it's never changed without examining the entire program). There is no standard mechanism for separate compilation: this makes building and maintaining large programs challenging. These facilities were provided by extensions in some implementations of the language, but usually in non-portable ways.

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
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
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
ALGOL 60 3.951 MARST 2.7, GCC 4.8.1 -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
Forth 9.92 Gforth 0.7.0, Linux
COBOL 12.5
46.3
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
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

The ALGOL 60 benchmark was developed and run under the GNU MARST ALGOL 60 to C translator. C code was compiled with GCC 4.8.1 with -O3 for the x86_64 architecture. MARST is a reference implementation of ALGOL 60 which includes extensive run-time checking in the C code it generates. A modern purpose-built optimising compiler for ALGOL 60 should, as long as programmers minimise use of call by name procedure parameters, perform at a speed comparable to modern compiled languages.

Posted at 22:45 Permalink