[Benchmark] add test case

This commit is contained in:
Watson
2014-02-24 07:40:09 +09:00
parent ac35f1fb0e
commit b5682f5719
5 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
def string_match(x)
x.report "=~ with ASCII" do
100000.times do
"hello world" =~ /lo/
end
end
x.report "=~ with UTF8" do
100000.times do
"あいうえお" =~ /うえ/
end
end
x.report "=~ with dynamic regexp" do
str = "lo"
50000.times do
"hello world" =~ /#{str}/
end
end
end