Sha256: eef0c46d1395156ae2340b414ef75ef4dfe65b030cd7b221e2a9b562ffa6698a

Contents?: true

Size: 377 Bytes

Versions: 3

Compression:

Stored size: 377 Bytes

Contents

#!/usr/bin/env ruby

$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))

require 'chars'
require 'benchmark'

CHARSET = Chars::ALPHA_NUMERIC
N       = 1_000_000
STRING  = ('A' * N) + '!'
ENUM    = (['A', 0x42] * (N / 2)) << '!'

Benchmark.bm(12) do |b|
  b.report('String')     { CHARSET === STRING }
  b.report('Enumerable') { CHARSET === ENUM }
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chars-0.2.4 benchmarks/compare.rb
chars-0.2.3 benchmarks/compare.rb
chars-0.2.2 benchmarks/compare.rb