Getting Started with PyPy | Paperspace Blog

The Python programming language is an interface that can be implemented in many ways. Some examples include CPython which uses the C language, Jython that is implemented using Java, and so on.


This is a companion discussion topic for the original entry at https://blog.paperspace.com/getting-started-with-pypy

I tried ur example

import time

t1 = time.time()
nums = range(1000)
sum = 0
for k in nums:
sum = sum + k
print("Sum of 1,000 numbers is : ", sum)
t2 = time.time()
t = t2 - t1
print("Elapsed time is : “, t, " seconds”)

And fastest is normal Python3.

time python3 test.py
Sum of 1,000 numbers is : 499500
Elapsed time is : 0.0001461505889892578 seconds
python3 test.py 0,03s user 0,01s system 99% cpu 0,045 total

time pypy3 test.py
Sum of 1,000 numbers is : 499500
Elapsed time is : 0.00020265579223632812 seconds
pypy3 test.py 0,04s user 0,03s system 78% cpu 0,080 total