Files
RubyMotion/test/Benchmark/app/benchmark/string/new.rb
2014-02-13 13:08:41 +09:00

30 lines
603 B
Ruby

# -*- coding: utf-8 -*-
def string_new(x)
ascii = "The quick brown fox jumps over the lazy dog."
utf8 = "飛べねぇ豚はタダの豚だ...................."
x.report "literal with ASCII" do
1000000.times do
"The quick brown fox jumps over the lazy dog."
end
end
x.report "literal with UTF8" do
1000000.times do
"飛べねぇ豚はタダの豚だ...................."
end
end
x.report "new with ASCII" do
100000.times do
String.new(ascii)
end
end
x.report "new with UTF8" do
100000.times do
String.new(utf8)
end
end
end