mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-05 17:40:51 +08:00
30 lines
603 B
Ruby
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
|