Sha256: 58669b15629f719f732b963768ef48c77383aa7b83afe6a81701d15b2186de3e

Contents?: true

Size: 839 Bytes

Versions: 34

Compression:

Stored size: 839 Bytes

Contents

$:.unshift File.expand_path('../lib', __dir__)

require 'benchmark'
require 'mustermann/simple'
require 'mustermann/sinatra'

[Mustermann::Simple, Mustermann::Sinatra].each do |klass|
  puts "", " #{klass} ".center(64, '=')
  Benchmark.bmbm do |x|
    no_capture = klass.new("/simple")
    x.report("no captures, match") { 1_000.times { no_capture.match('/simple') } }
    x.report("no captures, miss") { 1_000.times { no_capture.match('/miss') } }

    simple = klass.new("/:name")
    x.report("simple, match") { 1_000.times { simple.match('/simple').captures } }
    x.report("simple, miss") { 1_000.times { simple.match('/mi/ss') } }

    splat = klass.new("/*")
    x.report("splat, match") { 1_000.times { splat.match("/a/b/c").captures } }
    x.report("splat, miss") { 1_000.times { splat.match("/a/b/c.miss") } }
  end
  puts
end

Version data entries

34 entries across 31 versions & 5 rubygems

Version Path
mustermann-3.0.3 bench/simple_vs_sinatra.rb
mustermann-3.0.2 bench/simple_vs_sinatra.rb
mustermann-3.0.1 bench/simple_vs_sinatra.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/mustermann-3.0.0/bench/simple_vs_sinatra.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/mustermann-3.0.0/bench/simple_vs_sinatra.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/mustermann-3.0.0/bench/simple_vs_sinatra.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/mustermann-3.0.0/bench/simple_vs_sinatra.rb
mustermann-3.0.0 bench/simple_vs_sinatra.rb
mustermann-2.0.2 bench/simple_vs_sinatra.rb
mustermann-2.0.1 bench/simple_vs_sinatra.rb
mustermann-2.0.0 bench/simple_vs_sinatra.rb
mustermann-1.1.2 bench/simple_vs_sinatra.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/2.6.0/gems/mustermann-1.1.1/bench/simple_vs_sinatra.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.0.0/gems/mustermann-1.1.1/bench/simple_vs_sinatra.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.1.0/gems/mustermann-1.1.1/bench/simple_vs_sinatra.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/mustermann-1.0.3/bench/simple_vs_sinatra.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/mustermann-1.1.1/bench/simple_vs_sinatra.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/mustermann-1.0.3/bench/simple_vs_sinatra.rb
mustermann-1.1.1 bench/simple_vs_sinatra.rb
mustermann-1.1.0 bench/simple_vs_sinatra.rb