Here's a benchmark for four Ruby implementations of a method to calculation the nth Fibonacci number. The implementations:
fib_recursive- A memoized recursive versionfib_iterative- An iterative versionfib_phi- A version using Binet's formula via an implementation of the arithmetic of ℚ(φ)fib_matrix- A version using Matrix exponentiation
While fib_phi is slower than fib_matrix, you can see that it has the same rate of growth.