-
Notifications
You must be signed in to change notification settings - Fork 1
Benchmarks
Matthew Trost edited this page Dec 19, 2015
·
1 revision
A recent benchmark comparing Runiq to raw JavaScript shows that JavaScript can range from 2X to 20X faster than Runiq, depending, of course, on the implementation. My system specs when running these benchmarks:
Mid-2012 MacBook Pro
Processor - 2.6 GHz Intel Core i7
Memory - 8 GB 1600 MHz DDR3
Mac OS X 10.9.5
Node v5.1.0
Programs:
; Runiq ;
(ycomb (lambda fn n
'(if (<= n 2)
'(1)
else
'(+ (ycomb fn (- n 1))
(ycomb fn (- n 2))))
) 8)
// JavaScript
function fib(n) {
if (n <= 2) return 1;
return fib(n - 1) + fib(n - 2);
}
fib(8);
Result:
runiq x 39.51 ops/sec ±1.45% (66 runs sampled)
js x 751 ops/sec ±0.59% (19 runs sampled)
The slowness on this one is partially due to my slow implementation of ycomb.
Programs:
; Runiq ;
(filter (quote (1 2 3 4 5 6 7 8 9 0)) (lambda n
'(< n 3)
))
// JavaScript
Lodash.filter([1,2,3,4,5,6,7,8,9,0], function(n) {
return n < 3;
});
Results:
runiq x 365 ops/sec ±2.94% (69 runs sampled)
js x 717 ops/sec ±1.12% (33 runs sampled)