Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

Benchmarks

Oleg Lebedev edited this page Nov 17, 2015 · 2 revisions

fib(35)

mostly copied from gopher-lua benchmarks

Performance measurements in script languages on Go.

Machine: OS X 10.10.4 (14E46), 2,7 GHz Intel Core i5, 8 GB 1867 MHz DDR3

Go version: 1.4.2

prog time
otto 200.13s
anko 231.19s
agora 149.33s
GopherLua 8.39s
go-duktape 9.80s

fib.js

function fib(n) {
  if (n < 2) return n;
  return fib(n - 2) + fib(n - 1);
}

console.log(fib(35));
$ time ./bin/otto fib.js 
9227465
./bin/otto fib.js  200.13s user 4.01s system 101% cpu 3:21.48 total

fib.ank

func fib(n) {
  if n < 2 {
    return n
  }
  return fib(n - 2) + fib(n - 1)
}

println(fib(35));
$ time ./bin/anko fib.ank 
9227465
./bin/anko fib.ank  231.19s user 8.61s system 102% cpu 3:53.68 total

fib.agr

fmt := import("fmt")

func fib(n) {
  if n < 2 {
    return n
  }
  return fib(n-2) + fib(n-1)
}

fmt.Println(fib(35))
$ time ./bin/agora run fib.agr
9227465

= nil (runtime.null)
./bin/agora run fib.agr  149.33s user 10.51s system 105% cpu 2:31.72 total

fib.lua

local function fib(n)
    if n < 2 then return n end
    return fib(n - 2) + fib(n - 1)
end

print(fib(35))
$ time ./bin/glua fib.lua
9227465
./bin/glua fib.lua  8.39s user 0.13s system 99% cpu 8.541 total
$ time ./bin/go-duk fib.js 
9227465
./bin/go-duk fib.js  9.80s user 0.06s system 99% cpu 9.952 total
Clone this wiki locally