Files
RubyMotion/test/Benchmark/app/benchmark/string.rb
2014-02-24 07:41:48 +09:00

45 lines
2.0 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
def bm_string
Benchmark.benchmark("", 30, "%r\n") do |x|
string_chomp(x)
string_concat(x)
string_dup(x)
string_gsub(x)
string_equal(x)
string_include(x)
string_index(x)
string_length(x)
string_match(x)
string_new(x)
string_reverse(x)
string_slice(x)
string_split(x)
string_to_f(x)
string_to_i(x)
string_to_sym(x)
end
end
$short_sentence_ascii =<<EOS
IN THE YEAR 1878 I took my degree of Doctor of Medicine of the University of
London, and proceeded to Netley to go through the course prescribed for
surgeons in the Army. Having completed my studies there, I was duly attached
to the Fifth Northumberland Fusiliers as assistant surgeon. The regiment was
stationed in India at the time, and before I could join it, the second Afghan
war had broken out. On landing at Bombay, I learned that my corps had advanced
through the passes, and was already deep in the enemy's country. I followed,
however, with many other officers who were in the same situation as myself, and
succeeded in reaching Candahar in safety, where I found my regiment, and at
once entered upon my new duties.
EOS
$short_sentence_utf8 =<<EOS
1878
EOS