Guest User

julia fib() 1st-2nd run comparo

a guest
Jan 2nd, 2015
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. _
  2. _ _ _(_)_ | A fresh approach to technical computing
  3. (_) | (_) (_) | Documentation: http://docs.julialang.org
  4. _ _ _| |_ __ _ | Type "help()" for help.
  5. | | | | | | |/ _` | |
  6. | | |_| | | | (_| | | Version 0.3.4 (2014-12-26 10:42 UTC)
  7. _/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
  8. |__/ | x86_64-w64-mingw32
  9.  
  10. julia> fib(n) = n < 2 ? n : fib(n-1) + fib(n-2)
  11. fib (generic function with 1 method)
  12.  
  13. julia> @time fib(25)
  14. elapsed time: 0.002536768 seconds (45200 bytes allocated)
  15. 75025
  16.  
  17. julia> @time fib(25)
  18. elapsed time: 0.000785786 seconds (64 bytes allocated)
  19. 75025
  20.  
  21. julia>
Advertisement
Add Comment
Please, Sign In to add comment