Blog 2019/11/2
<- previous | index | next ->
Let's use a trivial (recursive) Fibonacci benchmark to compare the performance of a few Scheme interpreters.
(define (fib n) (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))
(display (fib $n))
(newline)
Specifically, I was interested in looking at start-up time and overall throughput (actually, function-call overhead).
- ๐ Startup time: Elk, Chicken
- ๐ Throughput: Chez, Racket
Overall results:
A close-up of the "knee" of the curve:
If we focus on small values of n
, we can compare start-up time. Here, non-JIT'ed interpreters will perform well.
If we focus on large values of n
, we get a sense of the overall throughput (actually, the function-call overhead) of the interpreters. Here, the JIT'ed interpreters will perform well.
Update: Just out of curiosity I've tried (fib 40) on my machine (MacBook Air 2019) for Guile 1.8, Guile 2.2.7, Guile 3.0.4 and S7, this are the results:
Guile 1.8.8 : 40.595 sec
Guile 2.2.7 : 8.102 sec
Guile 3.0.4 : 3.864 sec
S7 : 3.297 sec
The results for Guile2/3 are from the compiled code (excluding the compilation time). If we force Guile2/3 to use only the interpreter (with GUILE_AUTO_COMPILE=0 and clean cache) we have
Guile 2.2.7: 120 sec
Guile 3.0.4: 60 sec