- To run PyPy, simply go to the location where you placed the binary and call PyPy:
As can be seen, it looks like a standard Python interactive interpreter, so you can experiment with your code as normal.
- For a simple test to demonstrate how quick PyPy compares with normal Python, we will make a couple of files, as well as a C file, to see how well PyPy's JIT compiler compares:
-
- We save the following as add_funct.py:
def add(x, y): return x + y
-
- The following is loop_funct.py:
from file1 import add def loop(): i = 0 a = 0.0 while i < 1000000000: a += 1.0 add(a, a) i += 1 if __name__ == "__main__": loop()