Created
May 17, 2013 15:07
-
-
Save TheLarkInn/5599676 to your computer and use it in GitHub Desktop.
Benchmarking test requested from stackoverflow for a question.
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
n = 50_000_000 | |
bmp = Proc.new do | |
Benchmark.bm do |x| | |
x.report {n.times do; a = "1"; end} | |
x.report {n.times do; a = "1"; end} | |
x.report {n.times {a = "1"}} | |
end | |
end | |
perform = Proc.new {30.times {bmp.call}} | |
>> perform.call | |
user system total real | |
9.520000 0.070000 9.590000 ( 9.692028) | |
9.380000 0.180000 9.560000 ( 9.578314) #faster | |
user system total real | |
9.410000 0.070000 9.480000 ( 9.492356) #faster | |
9.370000 0.140000 9.510000 ( 9.536512) | |
user system total real | |
9.390000 0.120000 9.510000 ( 9.516096) | |
9.310000 0.070000 9.380000 ( 9.431921) #faster | |
user system total real | |
9.320000 0.120000 9.440000 ( 9.462447) #faster | |
9.420000 0.110000 9.530000 ( 9.558893) | |
user system total real | |
9.380000 0.090000 9.470000 ( 9.479850) #faster | |
9.370000 0.220000 9.590000 ( 9.591079) | |
user system total real | |
9.400000 0.090000 9.490000 ( 9.509937) | |
9.350000 0.040000 9.390000 ( 9.396709) #faster | |
user system total real | |
9.300000 0.060000 9.360000 ( 9.367012) #faster | |
9.370000 0.090000 9.460000 ( 9.493932) | |
user system total real | |
9.280000 0.150000 9.430000 ( 9.435515) | |
9.330000 0.060000 9.390000 ( 9.411133) #faster | |
user system total real | |
9.400000 0.060000 9.460000 ( 9.476379) | |
9.270000 0.060000 9.330000 ( 9.369029) #faster | |
user system total real | |
9.310000 0.060000 9.370000 ( 9.372522) #faster | |
9.430000 0.080000 9.510000 ( 9.531489) | |
user system total real | |
9.400000 0.160000 9.560000 ( 9.574589) #faster | |
9.430000 0.170000 9.600000 ( 9.654527) | |
user system total real | |
9.390000 0.160000 9.550000 ( 9.568271) | |
9.350000 0.030000 9.380000 ( 9.410098) #faster | |
user system total real | |
9.380000 0.100000 9.480000 ( 9.494201) #faster | |
9.370000 0.170000 9.540000 ( 9.572606) | |
user system total real | |
9.360000 0.020000 9.380000 ( 9.398756) #faster | |
9.380000 0.070000 9.450000 ( 9.469117) | |
user system total real | |
9.340000 0.070000 9.410000 ( 9.464893) #faster | |
9.420000 0.100000 9.520000 ( 9.545712) | |
user system total real | |
9.390000 0.140000 9.530000 ( 9.527269) #faster | |
9.360000 0.130000 9.490000 ( 9.536154) | |
user system total real | |
9.470000 0.050000 9.520000 ( 9.553368) | |
9.330000 0.100000 9.430000 ( 9.444813) #faster | |
user system total real | |
9.430000 0.070000 9.500000 ( 9.528752) | |
9.430000 0.070000 9.500000 ( 9.519137) #faster | |
user system total real | |
9.470000 0.080000 9.550000 ( 9.640673) | |
9.440000 0.060000 9.500000 ( 9.510949) #faster | |
user system total real | |
9.470000 0.080000 9.550000 ( 9.572427) | |
9.370000 0.090000 9.460000 ( 9.472883) #faster | |
user system total real | |
9.440000 0.090000 9.530000 ( 9.540451) #faster | |
9.440000 0.140000 9.580000 ( 9.592934) | |
user system total real | |
9.390000 0.020000 9.410000 ( 9.439135) #faster | |
9.460000 0.110000 9.570000 ( 9.611203) | |
user system total real | |
9.410000 0.100000 9.510000 ( 9.557501) | |
9.470000 0.070000 9.540000 ( 9.547528) #faster | |
user system total real | |
9.400000 0.060000 9.460000 ( 9.475510) #faster | |
9.380000 0.090000 9.470000 ( 9.489968) | |
user system total real | |
9.410000 0.070000 9.480000 ( 9.507796) #faster | |
9.460000 0.050000 9.510000 ( 9.540015) | |
user system total real | |
9.340000 0.030000 9.370000 ( 9.379441) #faster | |
9.410000 0.090000 9.500000 ( 9.522511) | |
user system total real | |
9.430000 0.060000 9.490000 ( 9.502413) | |
9.400000 0.060000 9.460000 ( 9.487975) #faster | |
user system total real | |
9.410000 0.100000 9.510000 ( 9.541401) | |
9.300000 0.010000 9.310000 ( 9.319426) #faster | |
user system total real | |
9.400000 0.050000 9.450000 ( 9.456597) #faster | |
9.430000 0.080000 9.510000 ( 9.557200) | |
user system total real | |
9.350000 0.120000 9.470000 ( 9.481717) #faster | |
9.440000 0.120000 9.560000 ( 9.585051) | |
=> 30 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment