add benchmarks for String

This commit is contained in:
Watson
2013-11-17 14:53:12 +09:00
parent fcde33dc3e
commit 0a6fcd84af
16 changed files with 644 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
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_new(x)
string_reverse(x)
string_slice(x)
string_split(x)
string_to_f(x)
string_to_i(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 enemys 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