Sha256: ef9f631856f0f721ad5d1cbbe31e9ba8a9f32d39b0327446bc3f4a73b38cc07c

Contents?: true

Size: 1.69 KB

Versions: 180

Compression:

Stored size: 1.69 KB

Contents

require 'benchmark'
require_relative "../../lib/public_suffix"

NAME_SHORT  = "example.de"
NAME_MEDIUM = "www.subdomain.example.de"
NAME_LONG   = "one.two.three.four.five.example.de"
NAME_WILD   = "one.two.three.four.five.example.bd"
NAME_EXCP   = "one.two.three.four.five.www.ck"

IAAA = "www.example.ac"
IZZZ = "www.example.zone"

PAAA = "one.two.three.four.five.example.beep.pl"
PZZZ = "one.two.three.four.five.example.now.sh"

JP   = "www.yokoshibahikari.chiba.jp"
IT   = "www.example.it"
COM  = "www.example.com"

TIMES = (ARGV.first || 50_000).to_i

# Initialize
PublicSuffixList = PublicSuffix::List.default
PublicSuffixList.find("example.com")

Benchmark.bmbm(25) do |x|
  x.report("NAME_SHORT") do
    TIMES.times { PublicSuffixList.find(NAME_SHORT) != nil }
  end
  x.report("NAME_MEDIUM") do
    TIMES.times { PublicSuffixList.find(NAME_MEDIUM) != nil }
  end
  x.report("NAME_LONG") do
    TIMES.times { PublicSuffixList.find(NAME_LONG) != nil }
  end
  x.report("NAME_WILD") do
    TIMES.times { PublicSuffixList.find(NAME_WILD) != nil }
  end
  x.report("NAME_EXCP") do
    TIMES.times { PublicSuffixList.find(NAME_EXCP) != nil }
  end

  x.report("IAAA") do
    TIMES.times { PublicSuffixList.find(IAAA) != nil }
  end
  x.report("IZZZ") do
    TIMES.times { PublicSuffixList.find(IZZZ) != nil }
  end

  x.report("PAAA") do
    TIMES.times { PublicSuffixList.find(PAAA) != nil }
  end
  x.report("PZZZ") do
    TIMES.times { PublicSuffixList.find(PZZZ) != nil }
  end

  x.report("JP") do
    TIMES.times { PublicSuffixList.find(JP) != nil }
  end
  x.report("IT") do
    TIMES.times { PublicSuffixList.find(IT) != nil }
  end
  x.report("COM") do
    TIMES.times { PublicSuffixList.find(COM) != nil }
  end
end

Version data entries

180 entries across 162 versions & 20 rubygems

Version Path
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb