# Flint vs NTL

## posted February 2015

I'm digging into the code source of Sage and I see that a lot of functions are implemented with Shoup's NTL. There is also FLINT used. I was wondering what were the differences. I can see that NTL is in c++ and FLINT is in C. On wikipedia:

It is developed by William Hart of the University of Warwick and David Harvey of Harvard University to address the speed limitations of the Pari and NTL libraries.

Although in the code source of Sage I'm looking at they use FLINT by default and switch to NTL when the modulus is getting too large.

By the way, all of that is possible because Sage uses Cython, which allows it to use C in python. I really should learn that...

EDIT:

This implementation is generally slower than the FLINT implementation in :mod:

`~sage.rings.polynomial.polynomial_zmod_flint`

, so we use FLINT by default when the modulus is small enough; but NTL does not require that`n`

be``int`

`-sized, so we use it as default when`n`

is too large for FLINT.

So the reason behind it seems to be that NTL is better for large numbers.