Skip to content

Instantly share code, notes, and snippets.

@brynary
Created March 23, 2009 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save brynary/83366 to your computer and use it in GitHub Desktop.
Save brynary/83366 to your computer and use it in GitHub Desktop.
require "benchmark"
x = 10_000
first_id = Sport.first.id
key = "Sport:#{first_id}"
Sport.set key, Sport.find(first_id) # prime cache
Benchmark.bm(20) do |b|
b.report "Sport.get" do
x.times do
Sport.get key
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment