Sha256: 6c248fbadf3db7b5352d530ff81abfa1fe0ae12b5d6bdd11968c629fa35ec44b

Contents?: true

Size: 302 Bytes

Versions: 1

Compression:

Stored size: 302 Bytes

Contents

# frozen_string_literal: true

require 'ddmemoize'

DDMemoize.enable_telemetry

class FibFast
  DDMemoize.activate(self)

  memoized def fib(n)
    case n
    when 0
      0
    when 1
      1
    else
      fib(n - 1) + fib(n - 2)
    end
  end
end

p FibFast.new.fib(1000)

DDMemoize.print_telemetry

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ddmemoize-1.0.0a3 samples/fib.rb