Skip to content

Instantly share code, notes, and snippets.

View amckinnell's full-sized avatar

Alistair McKinnell amckinnell

View GitHub Profile

Keybase proof

I hereby claim:

  • I am amckinnell on github.
  • I am alistairm (https://keybase.io/alistairm) on keybase.
  • I have a public key ASByx3NqEbAPNxvplXVRYuhBwzpmpGwwxL-ZrXRXmDyvVQo

To claim this, I am signing this object:

@amckinnell
amckinnell / gist:3321b470dd7c3123ad446229467ce15d
Created December 14, 2016 11:22
Memoizing for Performance
require "benchmark/ips"
Benchmark.ips do |x|
x.report("vanilla: ") { lookup_raw("vendors") }
x.report("memoized: ") { lookup_memoized("vendors") }
x.compare!
end
def lookup_raw(type)