mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-24 04:46:05 +08:00
[Benchmark] add test case
This commit is contained in:
21
test/Benchmark/app/benchmark/string/match.rb
Normal file
21
test/Benchmark/app/benchmark/string/match.rb
Normal 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
|
||||
Reference in New Issue
Block a user