Performance Impact Using Long vs. int in python

I need to manipulate large numbers in Python that fit in 64 bits. My code currently runs on a 64-bit platform, but there is a small but great opportunity that it will work on a 32-bit platform. Therefore, I would prefer to use a type longto represent my numbers. I understand that there is a performance effect for using type longover int. How bad is it? I will do many divisions and multiplications by them, but the results should also fit in 64 bits.

+5
source share
2 answers

If you are going to do a lot of heavy crunches, look at "numpy".

+3

- , , . , "" "" Python - , Python 3 .

: numpy, cython, C, pypy cpython, corepy - , , , , . , - C , , , .

+3

All Articles