Files
RubyMotion/test/Benchmark/app/benchmark/string/reverse.rb
2013-11-17 14:53:26 +09:00

28 lines
489 B
Ruby

def string_reverse(x)
x.report "reverse with ASCII" do
100000.times do
$short_sentence_ascii.reverse
end
end
x.report "reverse! with ASCII" do
100000.times do
str = $short_sentence_ascii.dup
str.reverse!
end
end
x.report "reverse with UTF8" do
100000.times do
$short_sentence_utf8.reverse
end
end
x.report "reverse! with UTF8" do
100000.times do
str = $short_sentence_utf8.dup
str.reverse!
end
end
end