[macruby-changes] [MacRuby/MacRuby] 6caf47: Performance improvement in String#split(sep, limit...
noreply at github.com
noreply at github.com
Mon Oct 24 09:47:38 PDT 2011
Branch: refs/heads/master
Home: https://github.com/MacRuby/MacRuby
Commit: 6caf474aeed57958f35eee3b1dc4fa4967046170
https://github.com/MacRuby/MacRuby/commit/6caf474aeed57958f35eee3b1dc4fa4967046170
Author: Watson <watson1978 at gmail.com>
Date: 2011-10-24 (Mon, 24 Oct 2011)
Changed paths:
M string.c
Log Message:
-----------
Performance improvement in String#split(sep, limit). reserved an array size which is result when passed a limit.
* before
user system total real
1.710000 0.040000 1.750000 ( 1.477479)
* after
user system total real
1.270000 0.050000 1.320000 ( 1.076221)
----
require 'benchmark'
Benchmark.bm do |x|
str = "abcdefg0123456789\n" * 2000
x.report do
1000.times do
str.split("\n", 1000)
end
end
end
More information about the macruby-changes
mailing list