[macruby-changes] [MacRuby/MacRuby] 48f006: improve a performance in String#index(pattern) whe...
GitHub
noreply at github.com
Fri Dec 28 16:08:05 PST 2012
Branch: refs/heads/master
Home: https://github.com/MacRuby/MacRuby
Commit: 48f006a49d5c97009f1b51e06af82e1005a41c32
https://github.com/MacRuby/MacRuby/commit/48f006a49d5c97009f1b51e06af82e1005a41c32
Author: Watson <watson1978 at gmail.com>
Date: 2012-12-28 (Fri, 28 Dec 2012)
Changed paths:
M string.c
Log Message:
-----------
improve a performance in String#index(pattern) when passed one character as pattern
* before
user system total real
index 3.190000 0.000000 3.190000 ( 3.195554)
* after
user system total real
index 0.300000 0.000000 0.300000 ( 0.296230)
Test Code:
----
require 'benchmark'
str = "hoge" * 10000 + "\n"
Benchmark.bm(7) do |x|
x.report "index" do
10000.times do
str.index("\n")
end
end
end
More information about the macruby-changes
mailing list