-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
bignumsBigInt and BigFloatBigInt and BigFloatperformanceMust go fasterMust go fasterrationalsThe Rational type and values thereofThe Rational type and values thereof
Description
As discussed on julia-dev, there is some performance advantage to using the GMP mpq functions for Rational{BigInt} operations.
The easiest way to do this would be:
- Make
BigIntanimmutabletype. (It currently has immutable semantics anyway.) This way,Rational{BigInt}would be binary compatible with GMP'smpq_t(a pointer to an__mpq_structconsisting of the numerator__mpz_structfollowed by the denominator), since ourBigInttype is already a mirror of__mpz_struct. - Define specialized
+etc. methods forRational{BigInt}that call GMPmpqfunctions.
I get the impression that the main reason that BigInt is a type and not immutable is that this makes it easier to pass by reference to GMP functions. So changing this to immutable would benefit greatly from a better way to pass ccall "out" arguments by reference, as discussed in #2322.
Alternatively, if you want to leave BigInt as-is, then one needs an easy way to convert BigInt to/from an immutable version thereof, and this requires us to add an additional "internal" constructor function BigInt(alloc::Cint, size::Cint, d::Ptr{Limb}).
Metadata
Metadata
Assignees
Labels
bignumsBigInt and BigFloatBigInt and BigFloatperformanceMust go fasterMust go fasterrationalsThe Rational type and values thereofThe Rational type and values thereof