In message “Re: BigNum optimizations”
on Wed, 18 Mar 2009 04:11:34 +0900, “M. Edward (Ed) Borasky” [email protected] writes:
|It might be easier to link to a standard open-source multi-precision
|library that it would be to revise the one that’s built into the Ruby
|interpreters. I haven’t benchmarked these against each other, but the
|two I know about are GMP http://gmplib.org/ and CLN
|CLN - Class Library for Numbers. Both are GPL.
We cannot link pure GPLed library to Ruby for licensing issue. Last
time I checked none of these multi precision numeric libraries
satisfied our criteria (license, portability, etc). GMP (or CLN or
whatever) can be used via extension, and we are happy to offer help if
required.
On Tue, Mar 17, 2009 at 5:56 PM, Yukihiro M. [email protected]
wrote:
We cannot link pure GPLed library to Ruby for licensing issue. Â Last
time I checked none of these multi precision numeric libraries
satisfied our criteria (license, portability, etc). Â GMP (or CLN or
whatever) can be used via extension, and we are happy to offer help if
required.
I just checked … GMP is LGPL. Would that work?
                            matz.
On Mon, Mar 16, 2009 at 4:23 PM, Yukihiro M. [email protected]
wrote:
------------------------------- total: 2.600000sec
Rehearsal ----------------------------------------
400 Â Â 0.070000 Â 0.000000 Â 0.070000 ( Â 0.092874)
800 Â Â 0.260000 Â 0.000000 Â 0.260000 ( Â 0.256951)
1600 Â 0.770000 Â 0.000000 Â 0.770000 ( Â 0.807816)
|But why Karatsuba? It is only O(N**1.585)  while Schönhage–Strassen is
|O(N log N).
It’s matter of the resource we have. Â If some one would volunteer to
implement it, we’d love to merge.
                            matz.
It might be easier to link to a standard open-source multi-precision
library that it would be to revise the one that’s built into the Ruby
interpreters. I haven’t benchmarked these against each other, but the
two I know about are GMP http://gmplib.org/ and CLN CLN - Class Library for Numbers. Both are GPL. GMP is available in just about
every Linux distro I know about; CLN may be a little harder to find,
but it’s in Debian and Gentoo. I don’t know about other platforms, but
at least GMP is “pure-enough” GNU that it should compile on Windows
and Macs and Solaris.
Ezra … is this something Engine Y. could do for 1.8.6 / Rubinius?
I think the jRuby people are working on their Bignum performance too.
In message “Re: BigNum optimizations”
on Wed, 18 Mar 2009 10:01:07 +0900, “M. Edward (Ed) Borasky” [email protected] writes:
|> We cannot link pure GPLed library to Ruby for licensing issue. Last
|> time I checked none of these multi precision numeric libraries
|> satisfied our criteria (license, portability, etc). GMP (or CLN or
|> whatever) can be used via extension, and we are happy to offer help if
|> required.
|
|I just checked … GMP is LGPL. Would that work?
Well, it’s not impossible (i.e. 1.8 regex was LGPL), but not ideal.
Some commercial Ruby users had to replace 1.8 regex by Oniguruma only
for a license issue. I don’t want to see same situation for bignums.
Ezra … is this something Engine Y. could do for 1.8.6 / Rubinius?
I think the jRuby people are working on their Bignum performance too.
We’re mostly just wrapping the JDK’s builtin BigInteger class, which is
not known for its scorching performance. BigInteger.doubleValue actually
passes the number through a a String and re-parses it (a contributor
implemented a replacement, for obvious reasons). There are alternative
libraries, but we have not merged them in to avoid bloating the size of
JRuby’s distribution.
Of course almost all of them can be called directly through our Java
integration layer, so if people need the performance they can do that.
Java 7 is supposed to include a number of performance improvements for
BigInteger as well.
We would not decline a clean-room implementation of Bignum that uses the
latest and greatest algorithms It would probably be easier in Java
than in C.
On Wed, Mar 18, 2009 at 10:10:45AM +0900, Yukihiro M. wrote:
|
|I just checked … GMP is LGPL. Would that work?
Well, it’s not impossible (i.e. 1.8 regex was LGPL), but not ideal.
Some commercial Ruby users had to replace 1.8 regex by Oniguruma only
for a license issue. I don’t want to see same situation for bignums.
How about libtommath/libtomfastmath ? there is a gem of it available:
On Tue, Mar 17, 2009 at 6:10 PM, Yukihiro M. [email protected]
wrote:
|I just checked … GMP is LGPL. Would that work?
Well, it’s not impossible (i.e. 1.8 regex was LGPL), but not ideal.
Some commercial Ruby users had to replace 1.8 regex by Oniguruma only
for a license issue. Â I don’t want to see same situation for bignums.
                            matz.
Yeah … the PostgreSQL community mostly uses BSD-style licenses
specifically because of the “chilling effect” of GPL on commercial
users. Actually, given that a lot of BigNum work came out of MIT, I’m
surprised there isn’t an MIT-licensed BigNum library running around
somewhere. Let me dig around into what’s in Sage (sagemath.org) and
what’s in Python. This is a wheel we shouldn’t have to re-invent or
even re-code.