Skip to content

bandersen23/fibonacci-benchmark

 
 

Repository files navigation

A Tiny Uncientific Benchmark for Nim

About


In this experiment I compared speed of execution of a program to print the n-th Fibonacci number.

The goal was to test the speed of Nim against Python and C, with Go being added later.

How to Run

1. Make sure you have the "languages" installed before you try to run these programs.

2. Compile the files that need to be compiled.

Nim:

nim c fibonacci.nim

Go:

go build fibonacci.go -o fib

C:

gcc fibonacci.c

3. Run and time the programs

To time the programs I used the time command in Bash. The first run of each program after system startup should be discarded, and we're interested in the "real" time.

Nim:

time ./fibonacci

Go:

time ./fib

C:

time ./a.out

Python:

time python3 fibonacci.py

Releases

No releases published

Packages

No packages published

Languages

  • Rust 18.6%
  • C 16.5%
  • JavaScript 16.1%
  • Go 15.2%
  • Julia 12.0%
  • Nim 11.4%
  • Python 10.2%