Project

General

Profile

Feature #12275 » benchmark2.rb

tad (Tadashi Saito), 12/09/2017 05:46 PM

 
require 'benchmark'

N = 1000_000
s = 'あいうえお'.dump
t = 'あいうえお'.encode('UTF-16LE').dump

Benchmark.bm(25) do |bm|
bm.report('eval') do
N.times{eval(s)}
end

bm.report('undump') do
N.times{s.undump}
end

bm.report('undump with force_encoding') do
N.times{t.undump}
end
end
(3-3/5)