Skip to content

Instantly share code, notes, and snippets.

@bogdan
Created February 7, 2015 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bogdan/a57fa9150d3b709cb1b1 to your computer and use it in GitHub Desktop.
Save bogdan/a57fa9150d3b709cb1b1 to your computer and use it in GitHub Desktop.
require "diffbench"
require "bundler"
Bundler.setup
$:.unshift "./lib"
require "action_view/test_case"
# Running benchmark with current working tree
# Checkout HEAD^
# Running benchmark with HEAD^
# Checkout to previous HEAD again
#
# user system total real
# -------------------------------------------------text_field
# After patch: 2.800000 0.000000 2.800000 ( 2.808846)
# Before patch: 2.770000 0.000000 2.770000 ( 2.772542)
# Improvement: -1%
#
# --------------------------------------------------check_box
# After patch: 5.370000 0.010000 5.380000 ( 5.369271)
# Before patch: 5.360000 0.010000 5.370000 ( 5.369497)
# Improvement: 0%
#
class Tester < ActionView::TestCase
end
tester = Tester.new('new')
# ramping around
1000.times do
tester.text_field(:post, :body)
end
DiffBench.bm do
report("text_field") do
100000.times do
tester.text_field(:post, :body)
end
end
report("check_box") do
100000.times do
tester.check_box(:post, :body)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment