doc • benchmark

Benchmarks

Gambas is an interpreted language, with no "just-in-time" or other compilation to native code at all up to the 3.2 version.

Here is some little benchmarks mostly stolen on the Internet used for comparing Gambas and Gambas JIT-compiled with interpreted Python and Perl.

The tests were done on my own computer, by running them with the time system utility. The execution time is the sum of the user time and the system time.

Note there is a little time used for compiling the source files in all languages.

Almost all benchmarks are stupid.

Results

Benchmark Python Perl Gambas Gambas + JIT
sort 4,30  8,52  5,36  0,43 
polynom 12,47  22,54  9,20  0,60 
primes 5,98  9,49  3,84  0,68 
nbody 6,02  7,77  5,43  0,93 
mandelbrot 6,68  4,96  3,83  0,12 
string 9,42  8,16  6,10  6,11 
Execution times are measured in seconds.

Language versions

The following versions of the languages were used:

  • Python 2.7.10.

  • Perl 5.20.2.

  • Gambas 3.8.90 (development version r7476).

Benchmark source code

To get the source code of the benchmarks, browse the benchmark directory in the Gambas source code.

Run the benchmark on your own system

There is a script named benchmark.gbs in the benchmark directory. Just open a terminal, change to that directory, and run it.

You will get the result as HTML data. If you want to share it, don't forget to specify which distribution you run and your CPU model.

For example, on my own system (with 4 cores, hence the four repeated lines):

$ uname -a
Linux benoit-kubuntu 4.2.0-16-generic #19-Ubuntu SMP Thu Oct 8 15:35:06 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$ cat /proc/cpuinfo | grep "model name"
model name      : Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz
model name      : Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz
model name      : Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz
model name      : Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz

Results with the last Gambas version and the new JIT compiler on the same system

The language versions were:

  • Python 2.7.15rc1.

  • Perl 5.26.1.

  • Gambas 3.11.90 (development version on 11/2/2018)

The system was Ubuntu 18.04 with Linux kernel 4.15.0-38-generic.

Benchmark Python Perl Gambas Gambas JIT Gambas JIT without compilation time
sort 3,93  6,36  4,76  0,84  0,25 
polynom 9,94  13,40  8,04  0,84  0,75 
primes 6,29  7,65  2,99  0,77  0,61 
nbody 4,54  4,55  4,03  0,68  0,29 
mandelbrot 5,34  4,24  3,06  0,22  0,10 
string 8,94  1,81  1,41  1,49  1,40 
Execution times are measured in seconds.

We can notice that there was a big optimization effort on recent Perl and Python versions. But Gambas is still not in bad shape.