But what, I hear someone ask, if I want to get speed from functions like this without compiling everything with -d:danger?
Given fib.nim: import std/[os, strutils] {.push checks: off, optimization: speed, inline.} proc fib(n:int):int{.raises:[].} = if n < 2: n else: fib(n-1) + fib(n-2) {.pop.} proc main() = echo commandLineParams()[0].parseInt.fib main() Run and fib2.nim: import std/[os, strutils] {.push inline.} proc fib(n:int):int{.raises:[].} = if n < 2: n else: fib(n-1) + fib(n-2) {.pop.} proc main() = echo commandLineParams()[0].parseInt.fib main() Run When compiled as such: $ nim c -d:release fib.nim $ nim c -d:danger fib2.nim Run This benchmark is consistent: Summary './fib 47' ran 1.10 ± 0.01 times faster than './fib2 47' Run