Project

General

Profile

Feature #12275 » benchmark.rb

tad (Tadashi Saito), 11/27/2017 07:55 PM

 
1
require 'benchmark'
2

    
3
N = 1000_000
4
s = 'あいうえお'.dump
5

    
6
Benchmark.bm do |bm|
7
  bm.report('eval  ') do
8
    N.times{eval(s)}
9
  end
10

    
11
  bm.report('undump') do
12
    N.times{s.undump}
13
  end
14
end