~/talk

Fibonacci Funhouse

Talkat RubyConf 2026 · 2026-07-14..07-16· [ruby]
speakerdeck:doliveirakn
slides:none on file

Starts with naive recursion that times out after ~32 and a Binet float formula that fails around 70 and throws a float error at ~1,475; switching to bigdecimal at 1,000 precision pushes correctness but slows things and rationals hit trouble near ~6,000. Enabling tail call optimization and disabling tracing lets a tail-recursive approach reach ~100,000. Moving to repeated squaring matrix exponentiation and especially fast doubling with memoized hash default proc blows past millions — the billionth Fibonacci (208,987,... digits) computes in ~10 seconds in Ruby.

AI-written summary · about

  1. 0:00Fibonacci Funhouse welcome
  2. 1:51Helpful interviewer intro
  3. 2:33Naive Fibonacci flaws
  4. 4:58Binet's constant time attempt
  5. 7:48Floating point precision issues
  6. 9:11BigDecimal for precision
  7. 11:39Rational numbers approach
  8. 13:45Tail call optimization in Ruby
  9. 16:08Iterative Fibonacci with enumerators
  10. 18:16Matrix multiplication method
  11. 21:26Repeated squares explained
  12. 24:19Fast doubling method
  13. 28:12C extensions vs Ruby performance
  14. 30:20Final thoughts
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.