зеркало из https://github.com/github/ruby.git
* array.c (rb_ary_zip): performance implement by using
ALLOCA_N() to allocate tmp buffer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0d5ec8a346
Коммит
07e3b30c84
|
@ -1,3 +1,8 @@
|
|||
Sun Aug 4 21:08:29 2013 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* array.c (rb_ary_zip): performance implement by using
|
||||
ALLOCA_N() to allocate tmp buffer.
|
||||
|
||||
Sun Aug 4 07:14:49 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* README.EXT, README.EXT.ja: Mention rb_integer_pack and
|
||||
|
|
10
array.c
10
array.c
|
@ -3161,15 +3161,15 @@ rb_ary_zip(int argc, VALUE *argv, VALUE ary)
|
|||
else
|
||||
result = rb_ary_new2(len);
|
||||
|
||||
if (block_given && arity > 1) {
|
||||
VALUE tmp = rb_ary_new2(argc+1);
|
||||
if (block_given && arity > 1 && argc+1 < 0x100) {
|
||||
VALUE *tmp = ALLOCA_N(VALUE, argc+1);
|
||||
|
||||
for (i=0; i<RARRAY_LEN(ary); i++) {
|
||||
rb_ary_store(tmp, 0, RARRAY_AREF(ary, i));
|
||||
tmp[0] = RARRAY_AREF(ary, i);
|
||||
for (j=0; j<argc; j++) {
|
||||
rb_ary_store(tmp, j+1, rb_ary_elt(argv[j], i));
|
||||
tmp[j+1] = rb_ary_elt(argv[j], i);
|
||||
}
|
||||
rb_yield_values2(argc+1, RARRAY_RAWPTR(tmp));
|
||||
rb_yield_values2(argc+1, tmp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче