« September 10, 2007 | Main | September 17, 2007 »

Sunday, September 16, 2007

Floating Point Benchmark: Pascal Language Added

I have been intending to add Pascal to the languages in which my trigonometry-intense floating point benchmark is implemented, and the recent release of version 2.2.0 of the Free Pascal Compiler provided the impetus to get started on the project. A new release of the benchmark collection including Pascal is now available for downloading.

Three different editions are available for the “Classic” Pascal (ISO 7185:1990), Extended Pascal (ISO 10206:1990), and Pascal with Borland extensions dialects of the language. Other than changes in identifier names which do not affect generated code, there are no differences whatsoever among these editions in the actual code comprising the timed benchmark; only non-timed initialisation code is affected. All editions have been compiled without errors or warnings and tested to produce the correct results on both Free Pascal Compiler 2.2.0 and GNU Pascal 2.1.

The language relative performance table including results for these two Pascal compilers is as follows.

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
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

In comparing the two Pascal compilers, please note that while the Free Pascal Compiler release tested dates from less than a week ago, GNU Pascal 2.1, the current stable version, was released in May 2002, and the current Linux binary download was built with GCC core version 2.95.2 dating from 1999. It is entirely possible that building GNU Pascal with a more modern GCC back-end will make up the small (about 5%) speed disadvantage compared to Free Pascal, and possibly approach the GCC benchmarks for C and FORTRAN.

Posted at 20:13 Permalink