Created
December 29, 2018 06:43
-
-
Save kazuhisa/629ba91e21ce64f70cbfa9d8983324a0 to your computer and use it in GitHub Desktop.
Benchmark
This file contains hidden or 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
require 'csv' | |
require 'securerandom' | |
require 'benchmark' | |
writer = CSV.open('/tmp/out.csv', 'w') | |
Benchmark.bm 10 do |r| | |
r.report "ベンチマーク" do | |
1_000_000.times.each do | |
writer << [SecureRandom.hex(10), rand(1_000)] | |
end | |
end | |
end | |
# work$ rbenv shell 2.3.6 | |
# work$ ruby work.rb | |
# user system total real | |
# ベンチマーク 3.790000 0.030000 3.820000 ( 3.846696) | |
# work$ rbenv shell 2.6.0 | |
# work$ ruby work.rb | |
# user system total real | |
# ベンチマーク 6.320964 10.233759 16.554723 ( 16.583935) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment