Collection of Nim implementations for The Computer Language Benchmarks Game
C Nim Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore Update compile.sh and run.sh May 13, 2017
README.md Fix nbody_3 Mar 18, 2015
bench.nim Update compile.sh and run.sh May 13, 2017
binarytrees.c Add binarytrees Mar 23, 2015
binarytrees.nim Update compile.sh and run.sh May 13, 2017
binarytrees_2.nim Update compile.sh and run.sh May 13, 2017
binarytrees_3.nim Update compile.sh and run.sh May 13, 2017
binarytrees_op.nim Update compile.sh and run.sh May 13, 2017
compile.sh Update compile.sh and run.sh May 13, 2017
fannkuch.c Update compile.sh and run.sh May 13, 2017
fannkuch.nim Update compile.sh and run.sh May 13, 2017
fannkuch0.nim Initial commit of remaining Alioth Shootout benchmarks. May 12, 2017
fannkuch1.nim Initial commit of remaining Alioth Shootout benchmarks. May 12, 2017
fannkuch2.nim Initial commit of remaining Alioth Shootout benchmarks. May 12, 2017
fannkuch3.nim Initial commit of remaining Alioth Shootout benchmarks. May 12, 2017
fannkuch4.nim Initial commit of remaining Alioth Shootout benchmarks. May 12, 2017
fannkuch5.nim Initial commit of remaining Alioth Shootout benchmarks. May 12, 2017
fannkuchST.nim Initial commit of remaining Alioth Shootout benchmarks. May 12, 2017
fastaredux.c Add C comparisons Feb 3, 2015
fastaredux.nim Initial commit Feb 3, 2015
knucleotide-input0.txt Update compile.sh and run.sh May 13, 2017
knucleotide.c Update compile.sh and run.sh May 13, 2017
knucleotide.nim Update compile.sh and run.sh May 13, 2017
knucleotide2pass.nim Update compile.sh and run.sh May 13, 2017
knucleotideST.nim Update compile.sh and run.sh May 13, 2017
mandelbrot.c Update compile.sh and run.sh May 13, 2017
mandelbrot.nim Update compile.sh and run.sh May 13, 2017
mandelbrot8.nim Update compile.sh and run.sh May 13, 2017
nbody.c Add C comparisons Feb 3, 2015
nbody.nim Initial commit Feb 3, 2015
nbody_2.nim Update compile.sh and run.sh May 13, 2017
nbody_3.nim Fix nbody_3 Mar 18, 2015
perms.nim Initial commit of remaining Alioth Shootout benchmarks. May 12, 2017
pidigits.c Add C comparisons Feb 3, 2015
pidigits_bigints.nim Update compile.sh and run.sh May 13, 2017
pidigits_gmp.nim Update compile.sh and run.sh May 13, 2017
regex.c Update compile.sh and run.sh May 13, 2017
regex.nim Initial commit of remaining Alioth Shootout benchmarks. May 12, 2017
regexdna-input0.txt Update compile.sh and run.sh May 13, 2017
revcomp-input0.txt Update compile.sh and run.sh May 13, 2017
revcomp.c Update compile.sh and run.sh May 13, 2017
revcomp.nim Initial commit of remaining Alioth Shootout benchmarks. May 12, 2017
run.sh Update compile.sh and run.sh May 13, 2017
spectralnorm.c Update compile.sh and run.sh May 13, 2017
spectralnorm.nim Update compile.sh and run.sh May 13, 2017

README.md

Nim implementations for The Computer Language Benchmarks Game

Compared to C implementations from http://benchmarksgame.alioth.debian.org/ . These are among the fastest. All benchmarks run on my Intel Core2Quad Q9300, x86_64, single core. I'm running Linux with gcc 4.9.2, clang 3.5.1 and nim from devel branch.

See each file for information about where it's from. Contributions are welcome.

To run the benchmarks on your machine:

./compile.sh
./run.sh

nbody

Implementation Time [s] Memory [KB]
nbody_nim_gcc 12.25 1708
nbody_nim_clang 16.90 1768
nbody_2_nim_gcc 10.64 1932
nbody_2_nim_clang 14.66 1836
nbody_3_nim_gcc 11.17 1824
nbody_3_nim_clang 14.74 1756
nbody_c 10.17 1596

pidigits

Implementation Time [s] Memory [KB]
pidigits_gmp_nim_gcc 1.70 2760
pidigits_gmp_nim_clang 1.66 2736
pidigits_bigints_nim_gcc 27.66 7968
pidigits_bigints_nim_clang 27.28 8500
pidigits_c 1.66 2400

fastaredux

Implementation Time [s] Memory [KB]
fastaredux_nim_gcc 2.76 1440
fastaredux_nim_clang 3.21 1384
fastaredux_c 1.80 1368

Related work

There are some other nice benchmarks online comparing Nim to other languages: