From 18ece3991f1ed26a086bc919648bcec0f090c13d Mon Sep 17 00:00:00 2001 From: murphy Date: Sat, 29 Oct 2005 14:10:56 +0000 Subject: test/ruby/test-fitter.rb --> test/ruby/test-fitter.in.rb --- test/ruby/test-fitter.in.rb | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 test/ruby/test-fitter.in.rb diff --git a/test/ruby/test-fitter.in.rb b/test/ruby/test-fitter.in.rb new file mode 100644 index 0000000..7d00da6 --- /dev/null +++ b/test/ruby/test-fitter.in.rb @@ -0,0 +1,45 @@ +require 'benchmark' +require 'fits' + +N = 100_000 + +def test s + puts s + Benchmark.bm 10 do |bm| + bm.report 'default' do + N.times { s =~ /\A\w+\z/ } + end + + bm.report 'fits?' do + N.times { s.fits? /\w+/ } + end + + bm.report 'f' do + N.times { s =~ /\w+/.f } + end + + re = /\w+/.f + + bm.report 'preparsed' do + N.times { s =~ re } + end + end + puts +end + +a.fits? / bla /x + +test 'harmlessline' + +test <Destroy my HTML! +harmlessline +EOL + +test <Destroy my HTML! +harmlessline +EOL + -- cgit v1.2.1