Created
May 15, 2013 06:46
-
-
Save bogdan/5582062 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GistID: 5582062 | |
require "diffbench" | |
load 'output_safety.rb' | |
N = 10000 | |
b = ActiveSupport::SafeBuffer.new("hello world") | |
DiffBench.bm do | |
report "capitalize in safe buffer" do | |
N.times do | |
b.capitalize | |
end | |
end | |
end | |
# > git checkout 069ea45; diffbench bench.rb; diffbench bench.rb;diffbench bench.rb;diffbench bench.rb;diffbench bench.rb;diffbench bench.rb;diffbench bench.rb; | |
# | |
# Running benchmark with current working tree | |
# Checkout HEAD^ | |
# Running benchmark with HEAD^ | |
# Checkout to previous HEAD again | |
# | |
# user system total real | |
# ----------------------------------capitalize in safe buffer | |
# After patch: 0.010000 0.000000 0.010000 ( 0.009733) | |
# Before patch: 0.010000 0.000000 0.010000 ( 0.007702) | |
# Improvement: -26% | |
# | |
# Running benchmark with current working tree | |
# Checkout HEAD^ | |
# Running benchmark with HEAD^ | |
# Checkout to previous HEAD again | |
# | |
# user system total real | |
# ----------------------------------capitalize in safe buffer | |
# After patch: 0.010000 0.000000 0.010000 ( 0.009768) | |
# Before patch: 0.010000 0.000000 0.010000 ( 0.007896) | |
# Improvement: -24% | |
# | |
# Running benchmark with current working tree | |
# Checkout HEAD^ | |
# Running benchmark with HEAD^ | |
# Checkout to previous HEAD again | |
# | |
# user system total real | |
# ----------------------------------capitalize in safe buffer | |
# After patch: 0.010000 0.000000 0.010000 ( 0.009938) | |
# Before patch: 0.010000 0.000000 0.010000 ( 0.007768) | |
# Improvement: -28% | |
# | |
# Running benchmark with current working tree | |
# Checkout HEAD^ | |
# Running benchmark with HEAD^ | |
# Checkout to previous HEAD again | |
# | |
# user system total real | |
# ----------------------------------capitalize in safe buffer | |
# After patch: 0.010000 0.000000 0.010000 ( 0.010001) | |
# Before patch: 0.010000 0.000000 0.010000 ( 0.007873) | |
# Improvement: -27% | |
# | |
# Running benchmark with current working tree | |
# Checkout HEAD^ | |
# Running benchmark with HEAD^ | |
# Checkout to previous HEAD again | |
# | |
# user system total real | |
# ----------------------------------capitalize in safe buffer | |
# After patch: 0.010000 0.000000 0.010000 ( 0.009670) | |
# Before patch: 0.010000 0.000000 0.010000 ( 0.007800) | |
# Improvement: -24% | |
# | |
# Running benchmark with current working tree | |
# Checkout HEAD^ | |
# Running benchmark with HEAD^ | |
# Checkout to previous HEAD again | |
# | |
# user system total real | |
# ----------------------------------capitalize in safe buffer | |
# After patch: 0.010000 0.000000 0.010000 ( 0.009949) | |
# Before patch: 0.010000 0.000000 0.010000 ( 0.007752) | |
# Improvement: -28% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment