Using PyPy to run a Python program?

I was told that you can use PyPy to run Python programs, which is much faster since it compiles using the JIT compiler rather than being interpreted.

The following program finds the largest simple coefficient for the number 600851475143:

import numpy as np nr = 600851475143 n = 2 while n <= np.sqrt(nr): if nr%n == 0: nr = nr/n n += 1 print(nr) 

What was the procedure to run using PyPy?

I know that there is documentation on my site , but I do not understand this and I will be grateful for the demonstration.

+5
source share
1 answer

Add this shebang line to the beginning of the program:

 #!/usr/bin/env pypy 

If you want to do this manually, simply enter pypy main.py at the command line.

+7
source

Source: https://habr.com/ru/post/1203029/


All Articles