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, and absolute results may vary between two successive runs.
Results with the last Gambas version and the new JIT compiler
Ubuntu 21.04
Kernel and languages versions were:
Benchmark |
Python |
Perl |
Gambas |
Gambas JIT |
Gambas JIT without compilation time |
mandelbrot |
5,27 |
3,83 |
2,85 |
0,21 |
0,10 |
nbody |
4,30 |
4,56 |
3,87 |
0,59 |
0,31 |
polynom |
9,69 |
14,38 |
6,65 |
0,53 |
0,45 |
primes |
6,90 |
7,78 |
2,59 |
0,67 |
0,55 |
sort |
3,54 |
6,32 |
4,43 |
0,65 |
0,07 |
string |
8,80 |
1,77 |
1,37 |
1,47 |
1,39 |
string2 |
5,34 |
2,95 |
1,77 |
1,24 |
1,16 |
Execution times are measured in seconds.
Ubuntu 20.04
Kernel and languages versions were:
Benchmark |
Python |
Perl |
Gambas |
Gambas JIT |
Gambas JIT without compilation time |
mandelbrot |
5,04 |
3,94 |
3,07 |
0,22 |
0,09 |
nbody |
4,18 |
4,57 |
3,71 |
0,68 |
0,28 |
polynom |
9,91 |
13,13 |
6,71 |
0,53 |
0,44 |
primes |
6,43 |
7,98 |
3,10 |
0,65 |
0,51 |
sort |
3,38 |
5,86 |
4,35 |
0,70 |
0,07 |
string |
8,77 |
1,72 |
1,41 |
1,48 |
1,39 |
string2 |
5,44 |
2,94 |
1,91 |
1,42 |
1,34 |
Execution times are measured in seconds.
Ubuntu 19.10
Kernel and languages versions were:
Benchmark |
Python |
Perl |
Gambas |
Gambas JIT |
Gambas JIT without compilation time |
mandelbrot |
4,95 |
3,93 |
3,03 |
0,22 |
0,10 |
nbody |
4,36 |
4,53 |
4,06 |
0,66 |
0,29 |
polynom |
10,14 |
12,63 |
8,92 |
0,53 |
0,44 |
primes |
6,37 |
7,76 |
3,52 |
0,63 |
0,51 |
sort |
3,36 |
5,77 |
5,05 |
0,60 |
0,06 |
string |
9,21 |
2,00 |
1,44 |
1,53 |
1,44 |
string2 |
5,27 |
2,92 |
1,96 |
1,35 |
1,28 |
Execution times are measured in seconds.
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 5.3.0-45-generic #37-Ubuntu SMP Thu Mar 26 20:41:27 UTC 2020 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