From: Eric Wong Date: 2013-08-16T19:32:20+00:00 Subject: [ruby-core:56659] Re: [ruby-trunk - Feature #8796][Open] Use GMP to accelerate Bignum operations "akr (Akira Tanaka)" wrote: > If a user don't want to use GMP, a configure option, --without-gmp, > disables this feature. > Since GMP is licensed as LGPL, some people would need it. > However I think most people can accept LGPL as Ruby 1.8's regex engine. > So, my patch uses GMP by default, if it is available. I'm happy with LGPL :) > It converts bignums from RBignum to mpz_t and back for each > large Bignum multiplication. > RBignum structure itself is not changed and ABI compatible. > (So, this is different from ko1's idea mentioned in Feature #6083) > > The conversion cost is O(n). > It is negligible for operations slower than O(n) with large inputs. > Multiplication is a kind of such operation. Is there more performance improvement without the conversion? How about push the conversion cost to legacy C API users to make Bignum faster for pure-Ruby use in a future patch? I'm mainly curious about "smaller" Bignums for users on 32-bit systems, but I suspect much of that cost is object allocation.