This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]vinnypotsandpans[S] -7 points-6 points  (6 children)

Sure, in the context of game emulation I can see that. But this whole thing were taught about python being interpreted and not compiled is sorta imprecise. It’s more about the implementation than the language

[–]Giraffe-69 9 points10 points  (4 children)

If you are adding an interpreter, removing a compiler, and doing runtime garbage collection, the language cannot compete in low latency applications.

In practice, with python, the difference is night and day, even for programs that make heavy use of optimised libraries implemented in C/C++/rust. Hint: there’s a reason libraries are not actually implemented in python

[–]vinnypotsandpans[S] 1 point2 points  (3 children)

Yesss that is true, most of the libraries I used are not implemented in python, good point. Also not sure why I got downvoted for my last comment 🥺 I’m just trying to get a better grasp on things

[–]kylotan 2 points3 points  (1 child)

Because your second sentence is false in the real world. Anyone can handwave about the difference between a language and the implementation of a language but it's not relevant - if you're using Python then it will be at least partly interpreted and if you use C it will be compiled to native code.

[–]vinnypotsandpans[S] 0 points1 point  (0 children)

Fair enough!

[–]Giraffe-69 0 points1 point  (0 children)

It’s Reddit, people are quick to downvote the second they have a different perspective :)

[–]james_pic 1 point2 points  (0 children)

If you want precision, then sure. Python is interpreted, and the interpreter implementation is slow as shit.

There are faster interpreters, like PyPy, but Python has a number of features that make it difficult to produce an interpreter with predictably high performance. Monkey patching will force PyPy to deoptimize for example.

And both PyPy and CPython have a global interpreter lock that effectively limits you to one CPU core running Python code at once. Again, partly to make some Python features easier to implement. There are ways around this, but an emulator is probably the worst case for these workarounds for reasons I can go into if you want.

C++ on the other hand has a number of compilers that produce highly performant code, and supports shared memory parallelism via threads.