STINNER Victor added the comment: > > P.P.S.: Just a random idea: would it be a to rewrite PyLong to use GMP > > instead as a PyVarObject of mp_limb_t's? > I'll let Victor answer that one. :-) In the mean time, see issue 1814.
During the development of Python 3.0, I wrote a large patch to reuse directly GMP for Python int. My conclusion is here: http://bugs.python.org/issue1814#msg77018 (hint: "it's not a good idea") IMO the first problem is the memory allocation. GMP type doesn't fit well with Python type. GMP type for "int" has a fixed size, and then GMP allocates a second structure for digits. It's inefficient for small integers, and almost all Python int are small (smaller than 32 or 64 bits). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21111> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com