Gambas Documentation - /doc/benchmark

/doc/benchmark

# Benchmarking

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 (an Intel Core i5 @3.40 GHz running Ubuntu 14.10 64 bits), 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

Execution times are measured in seconds.

Benchmark | Python | Perl | Gambas | Gambas + JIT
--- | --- | --- | --- | ---
`sort` | 4,63 | 85,99 | 5,34 | 0,39
`polynom` | 30,85 | 41,64 | 24,97 | 1,14
`primes` | 14,89 | 19,70 | 12,37 | 2,48
`nbody` | 11,71 | 16,20 | 11,51 | 1,68
`mandelbrot` | 20,15 | 12,23 | 10,63 | 0,28

## Language versions

The following versions of the languages were used:

- Python 2.7.6.

- Perl 5.18.2.

- Gambas 3.6.90 (development version).

## 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 black-tower 3.13.0-39-generic #66-Ubuntu SMP Tue Oct 28 13:30:27 UTC 2014 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