Sha256: b2da7166eae8c611da9c451eebd2281c0d0d33dba49e9947cd9f725c6a89d224
Contents?: true
Size: 1010 Bytes
Versions: 33
Compression:
Stored size: 1010 Bytes
Contents
$:.unshift File.expand_path('../lib', __dir__) require 'benchmark' require 'mustermann/template' require 'addressable/template' [Mustermann::Template, Addressable::Template].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("/{match}") x.report("simple, match") { 1_000.times { simple.match('/simple').captures } } x.report("simple, miss") { 1_000.times { simple.match('/mi/ss') } } explode = klass.new("{/segments*}") x.report("explode, match") { 1_000.times { explode.match("/a/b/c").captures } } x.report("explode, miss") { 1_000.times { explode.match("/a/b/c.miss") } } expand = klass.new("/prefix/{foo}/something/{bar}") x.report("expand") { 100.times { expand.expand(foo: 'foo', bar: 'bar').to_s } } end puts end
Version data entries
33 entries across 30 versions & 5 rubygems