Sha256: ae14c618bea374524834a23e54b7b46832de7d66029a7cf043b4d61f8a394d5b

Contents?: true

Size: 523 Bytes

Versions: 3

Compression:

Stored size: 523 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
STRING  = File.open('/usr/bin/openssl','rb') do |file|
            file.read
          end

Benchmark.bm(24) do |b|
  b.report('strings_in') do
    CHARSET.strings_in(STRING) { |offset,string| }
  end

  (5..20).step(5) do |n|
    b.report("strings_in (length=#{n})") do
      CHARSET.strings_in(STRING, :length => n) { |offset,string| }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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