Skip to content

Commit

Permalink
Optimize the rary_reserve() using the GC_MEMMOVE.
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 committed Jun 15, 2011
1 parent db1e9fc commit 534ffd0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions array.c
Expand Up @@ -37,9 +37,9 @@ rary_reserve(VALUE ary, size_t newlen)
else {
newlen -= rary->beg;
}
for (size_t i = 0; i < rary->len; i++) {
GC_WB(&rary->elements[i], rary->elements[rary->beg + i]);
}
GC_MEMMOVE(&rary->elements[0],
&rary->elements[rary->beg],
sizeof(VALUE) * rary->len);
rary->beg = 0;
}
if (newlen > rary->cap) {
Expand Down

0 comments on commit 534ffd0

Please sign in to comment.