Author h.venev
Recipients h.venev
Date 2014-07-05.12:22:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1404562944.87.0.0403783440946.issue21922@psf.upfronthosting.co.za>
In-reply-to
Content
I have implemented the PyLong interface using the GMP mpn functions. API/ABI compatibility is retained (except for longintrepr).

It can be enabled by passing --enable-big-digits=gmp to ./configure.

No large performance regressions have been observed for small numbers (a few operations are about 10% slower). For large numbers some operations are a lot faster.

There is also int.__gcd__ which may be used by fractions.gcd.

The GIL is sometimes released. Minimum number of digis for releasing GIL: 
- multiplication - 64
- division - 64,
- modular exponentiation - 16,
- base conversion - 64 (256 for binary bases)
- GCD - 16

The tests for long, float, decimal, fractions, string, unicode, bytes, pickle, marshal and enum pass. The tests for int fail because the error messages are a bit different (when creating int from bytes or bytearray the value is not shown). I may have run other tests and they have not failed. I have not tested on anything but x86-64.

The following testcases yield 42x performace improvement:
- 16384-bit RSA on 8 threads on quad-core with HT # GIL released
- Multiplying 5600000-bit ints
- Dividing 6000000-bit ints
- Converting 300000-character str to int(base=10)
- Converting 1250000-bit int to str
History
Date User Action Args
2014-07-05 12:22:24h.venevsetrecipients: + h.venev
2014-07-05 12:22:24h.venevsetmessageid: <1404562944.87.0.0403783440946.issue21922@psf.upfronthosting.co.za>
2014-07-05 12:22:24h.venevlinkissue21922 messages
2014-07-05 12:22:23h.venevcreate