Different Behaviour of the Program when using PyPy Interpreter

17 views
Skip to first unread message

Leonardo Ariani

unread,
Dec 18, 2024, 12:41:22 PM12/18/24
to Python-MIP
Hello everyone,

I'm working on a problem similar to TSP, that I implemented it using the Python-MIP. To test the program with PyPy interpreter (to test if it realy runs 25 times faster than CPython, as claimed), I created two virtual environments in VSCode, one with CPython and one with PyPy. When I test the program with a datset run on CPython, it solves the problem in ca. 4 seconds. The same program and dataset run on PyPy takes so long, that ihave to kill the process. 

As far as I know the interpreter only executes the commands in the program. I know that every interpreter or compiler has its own way of execution. But at the end they all execute the same statements given to them by the program. They should not change the logic of the program! But when you look at the output of the both interpreters (see attachments), it looks as if they were solving two totally different programs! 

How is it that one is finished after 4 seconds and the other one goes into a long loop, although the program logic and dataset are the same? And why do we have such a different outputs?

Thank you for your help!
CPython.log
PyPy.log
Reply all
Reply to author
Forward
0 new messages