New submission from Hristo Venev: 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 ---------- components: Interpreter Core messages: 222347 nosy: h.venev priority: normal severity: normal status: open title: PyLong: use GMP type: performance versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21922> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com