[macruby-changes] [5158] MacRuby/trunk/array.c
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jan 10 21:39:21 PST 2011
Revision: 5158
http://trac.macosforge.org/projects/ruby/changeset/5158
Author: watson1978 at gmail.com
Date: 2011-01-10 21:39:15 -0800 (Mon, 10 Jan 2011)
Log Message:
-----------
Performance improvement of the Array#*.
Test Script:
{{{
require 'benchmark'
times = 5000
Benchmark.bm do |x|
x.report{
500.times do
[1, "2", 3.0 ] * times
end
}
end
}}}
Result:
{{{
Before
$ macruby bm_ary_times.rb
user system total real
1.700000 0.250000 1.950000 ( 1.053512)
After
$ macruby bm_ary_times.rb
user system total real
1.170000 0.120000 1.290000 ( 0.677880)
))}}}
Modified Paths:
--------------
MacRuby/trunk/array.c
Modified: MacRuby/trunk/array.c
===================================================================
--- MacRuby/trunk/array.c 2011-01-11 04:22:50 UTC (rev 5157)
+++ MacRuby/trunk/array.c 2011-01-11 05:39:15 UTC (rev 5158)
@@ -2365,17 +2365,13 @@
if (ARY_MAX_SIZE/len < n) {
rb_raise(rb_eArgError, "argument too big");
}
+ rary_reserve(ary2, n * len);
for (long i = 0; i < len; i++) {
rary_concat(ary2, ary, 0, n);
}
}
- if (OBJ_TAINTED(ary)) {
- OBJ_TAINT(ary2);
- }
- if (OBJ_UNTRUSTED(ary)) {
- OBJ_UNTRUST(ary2);
- }
+ OBJ_INFECT(ary2, ary);
return ary2;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110110/50c66206/attachment-0001.html>
More information about the macruby-changes
mailing list