Files
RubyMotion/test/Benchmark/app/benchmark/string/include.rb
2014-02-13 00:15:10 +09:00

27 lines
552 B
Ruby

# -*- coding: utf-8 -*-
def string_include(x)
x.report "include? with ASCII match" do
100000.times do
$short_sentence_ascii.include?("Candahar")
end
end
x.report "include? with ASCII nomatch" do
100000.times do
$short_sentence_ascii.include?("abcde")
end
end
x.report "include? with UTF8 match" do
100000.times do
$short_sentence_utf8.include?("ロンドン")
end
end
x.report "include? with UTF8 nomatch" do
100000.times do
$short_sentence_utf8.include?("日本")
end
end
end