Skip to content

Instantly share code, notes, and snippets.

@michaelfairley
Created September 25, 2011 07:36
Show Gist options
  • Save michaelfairley/1240348 to your computer and use it in GitHub Desktop.
Save michaelfairley/1240348 to your computer and use it in GitHub Desktop.
Draper benchmark
require 'benchmark'
require 'draper'
class Model
# 300 is about the fewest methods an ActiveRecord model will have
300.times do |i|
define_method :"method_#{i}" do
i
end
end
end
class ModelDecorator < Draper::Base; end
time = Benchmark.measure do
1000.times do
d = ModelDecorator.decorate(Model.new)
end
end
puts time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment