Difference between revisions of "Improving language shootout results"

From Free Pascal wiki
Jump to navigationJump to search
Line 21: Line 21:
 
additional testing and comparing with C and other languages should be the main factor.
 
additional testing and comparing with C and other languages should be the main factor.
 
Special note: inlining of recursive functions is possible and sometimes increases speed.
 
Special note: inlining of recursive functions is possible and sometimes increases speed.
 +
 +
Another thing to use is {$implicitexceptions off} to keep rtl hindering speed. Make sure you use pChar
 +
when string operations are required. Use also only native sized integers and floats if possible.
  
 
==Shootout criticism==
 
==Shootout criticism==

Revision as of 10:08, 21 November 2005

About

The computer language shootout (http://shootout.alioth.debian.org/benchmark.php) is a realisticly flawed benchmarking system which compares many languages on illogical basis. See their homepage for more info.

Goals

Our goals are to be on the highest possible positions. The requirements to reach them can be categorized into two.

1: Optimizations on the assembler level. (core devel work)

2: Optimizations of the benchmarks. (junior devel work)

Way to go

It was decided that to keep memory requirements low it's best to use val() and str() and never include SysUtils unless really required. 32 bit integers should be used when possible to increase speed as the benchmarking machine is x86(athlon 1Gb, 256Mb ram). Use of inline and records instead of classes can also improve performance considerably, but additional testing and comparing with C and other languages should be the main factor. Special note: inlining of recursive functions is possible and sometimes increases speed.

Another thing to use is {$implicitexceptions off} to keep rtl hindering speed. Make sure you use pChar when string operations are required. Use also only native sized integers and floats if possible.

Shootout criticism

Any page about benchmarking should discuss the use of the benchmarks. FPC does relatively well overall, but is relatively weak in its category.

Criticising the shooutout is not difficult, I mention a few points below.

  • The main problem is that the applications are relatively short and highly computational. This has a lot of consequences:
    • they favour lower level languages, well, that is not in Pascal's advantage.
    • these benchmarks also favour compilers that aggressively optimize tight heavy calculating loops. FPC is not in that league, but, like Delphi, more geared to overall application performance, and not numeric or visual work with lots of tight loops. This is also why frameworks like Java and .NET don't score _that_ bad. Simply because the JIT can do good work for these tight loops.
    • Some benchmarks obviously target certain very specific optimizations like tail recursion optimization.
  • Language usability and overall speed of the development process is not measured at all.
    • Systems with a heavy RTL are punished. Both in size and startup time. However for actually getting work done, as long as it is not extreme, a full RTL is nice.
    • Languages that have a lower and higher level mode (e.g. FPC with its Pascal and Delphi levels) typically choose the lowest possible version, even if that is not the one typically used.