added nimcr to the party and I can confirm that nimcr + tcc takes the lead. I
now see your point, thanks. Didn't know about nimcr before.
I'd like to know why `nim r` is so much slower than `nimcr`, considering the
fact that it skips compilation if source is not changed, too.
#!/usr/bin/env nimcr
var c = 0
for i in 0 ..< 1_000_000:
c += 1
echo c
Run
rm -rf ~/.cache/nim/count_* && rm .count_nimcr && hyperfine --runs 10 'nim
r -d:debug count.nim' 'nim r -d:release count.nim' 'nim r -f -d:debug
count.nim' 'nim r -f -d:release count.nim' './count_nimcr.nim' 'nim e
count.nim' 'python count.py' 'bash count.bash' 'ruby count.rb'
Run
--threads:off
--cc:gcc
Summary
'ruby count.rb' ran
1.30 ± 4.03 times faster than './count_nimcr.nim'
1.81 ± 0.14 times faster than 'python count.py'
2.56 ± 1.50 times faster than 'nim r -d:debug count.nim'
3.23 ± 3.43 times faster than 'nim r -d:release count.nim'
4.17 ± 0.25 times faster than 'nim e count.nim'
6.49 ± 0.33 times faster than 'nim r -f -d:debug count.nim'
13.78 ± 1.43 times faster than 'nim r -f -d:release count.nim'
21.52 ± 1.74 times faster than 'bash count.bash'
Run
--threads:off
--cc:tcc
--passl:"-ldl -lm"
Summary
'./count_nimcr.nim' ran
1.95 ± 4.73 times faster than 'ruby count.rb'
3.37 ± 8.18 times faster than 'python count.py'
4.78 ± 11.67 times faster than 'nim r -d:debug count.nim'
5.08 ± 12.38 times faster than 'nim r -d:release count.nim'
8.08 ± 19.60 times faster than 'nim e count.nim'
8.50 ± 20.61 times faster than 'nim r -f -d:debug count.nim'
8.80 ± 21.34 times faster than 'nim r -f -d:release count.nim'
45.27 ± 109.84 times faster than 'bash count.bash'
Run