On Sat, Dec 3, 2016 at 10:53 PM, Ralf Stephan <> wrote:
"Both ZZ and numpy use libgmp internally "
No, ZZ uses libgmp (actually really MPIR, which is a fork of GMP), and numpy uses Python's ints/longs. Python's int/long type is arbitrary precision, despite the confusing naming. It only implements relatively naive algorithms -- karatsuba, etc., -- and not the asymptotically fast Fourier transform methods that GMP (and MPIR) implement and highly optimize. So Sage's ZZ will start beating the pants off of Python (and numpy) when the numbers get large.
Example -- try this with various values of "digits" and you'll see ZZ being arbitrarily faster than Python's longs: