Skip to content

Instantly share code, notes, and snippets.

@def-
Created May 9, 2017 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save def-/f25e5861e8a96935589894363e4bf7d4 to your computer and use it in GitHub Desktop.
Save def-/f25e5861e8a96935589894363e4bf7d4 to your computer and use it in GitHub Desktop.
import times
proc fib(n: int32): int32 =
if n <= 1: n
else: fib(n-1) + fib(n-2)
proc main =
let timeStart = epochTime()
var result: int32 = 0
for i in 0 ..< 100_000:
result = fib(24)
let timeStop = epochTime()
echo "result: ", result, ", time: ", timeStop - timeStart
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment