I run the tests with Gerbil, and compared with Racket, Go, and C. The Gerbil programs are new, for the others I used the existing (expertly written and heavily optimized) programs from the 23.03 Benchmarks Game, but see notes below.
Versions used: Gerbil v0.18, Racket v8.10, Go 1.21.2, and GCC 11.4
The source code for the benchmark game is here.
The benchmarks were run on a Dell XPS 13-9320 laptop.
Each benchmark was run 3 times, and I kept the best value.
Note C programs were compiled with gcc -O2
.
Note The benchmark all utilize a single core. I want to compare apples to apples, not how well a given language can multicore. Gerbil is also multicore capable, but the SMP backend is not stable yet; when it is, it will be time for Gerbil v1.0.
For C, I kept the fastest non-parallel programs that don't utilize architecture specific extensions, as these are not generally portable and don't even compile on my laptop. I want reproducible benchmarks, not something bogus that relies on a specific Intel chip.
That means that there may exist faster C programs out there, but they may or may not compile and run on any given machine, so I opted to stay portable.
NoteThis is not a d*ck swinging contest. I compiled these results to see how far I can push Gerbil's performance envelope and evaluate progress as the macrology/compiler improves. Take them with a grain of salt.
Color Coding: | best | within 10% | within 10-25% | within 25-50% | within 50-100% | within 100-200% | over 200% |
Benchmark | ⋄⋄⋄ | racket | ⋄⋄⋄ | go | ⋄⋄⋄ | gcc | ⋄⋄⋄ | gerbil |
---|---|---|---|---|---|---|---|---|
fannkuchredux | 4.71 (+115.%) | 2.61 (+19.1%) | 2.19 ↻ | 2.64 (+20.5%) | ||||
nbody | 1.90 (+322.2%) | 0.45 ↻ | 0.48 (+6.6%) | 0.47 (+4.4%) | ||||
spectralnorm | 3.03 (+697.3%) | 0.75 (+97.3%) | 0.38 ↻ | 0.41 (+7.8%) | ||||
mandelbrot | 10.16 (+126.7%) | 4.90 (+9.3%) | 5.54 (+23.6%) | 4.48 ↻ | ||||
pidigits | 0.37 (+60.8%) | 0.29 (+26.%) | 0.23 ↻ | 0.27 (+17.3%) | ||||
fasta | 1.90 (+493.7%) | 1.31 (+309.3%) | 0.43 (+34.3%) | 0.32 ↻ | ||||
binarytrees | 1.48 ↻ | 8.77 (+492.5%) | 4.43 (+199.3%) | 1.77 (+19.5%) |