From: TOYOFUKU Chikanobu Date: 2008-09-02T18:10:38+09:00 Subject: [ruby-dev:36100] optimize bigdivrem Part 3 豊福です。 bigdivrem の計算過程で使うオブジェクトの節約です。 生で ALLOC_N と free を使うのはよくない? --- bignum.c.org +++ bignum.c @@ -1678,8 +1678,8 @@ struct big_div_struct bds; long nx = RBIGNUM_LEN(x), ny = RBIGNUM_LEN(y), nz; long i, j; - volatile VALUE yy, z; - BDIGIT *xds, *yds, *zds, *tds; + volatile VALUE z; + BDIGIT *xds, *yds, *zds, *tds = 0; BDIGIT_DBL t2; BDIGIT dd, q; @@ -1729,8 +1729,7 @@ dd++; } if (dd) { - yy = rb_big_clone(y); - tds = BDIGITS(yy); + tds = ALLOC_N(BDIGIT, ny); j = 0; t2 = 0; while (j