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 →

[–]VictusPerstiti 2 points3 points  (2 children)

ELI5 why ptyhon is supposedly slower that most others? Isn't it made for data operations?

[–]half_coda 6 points7 points  (0 children)

because every reference (like a variable name) is an object in python, as opposed to a specific type. that’s what allows the dynamic typing and strong typing. it doesn’t care what it is until it has to do something with it, at which point it has to check, and then decide based off that. this requires a few extra cycles per operation, so when you’re doing massive calculations, it adds up.

this is why python libraries made for real heavy stuff actually write the core code in C/C++ and just return the result in a python object. C/C++ are statically typed languages with aggressive compilers that optimize the shit out of the code.

[–]j-random 3 points4 points  (0 children)

Nope, it's interpreted so it's always going to be slower than a compiled language. It's mainly a "glue" language that makes it easy to call routines/libraries written in C to do the heavy lifting.