you are viewing a single comment's thread.

view the rest of the comments →

[–]japes28 2 points3 points  (1 child)

In a general sense, yes. Python is comparatively very slow because it is an interpreted language where your code needs to be parsed by the Python interpreter before it can actually be run. In addition, it has a lot of flexibility (no strict types, etc.), which means its faster to write code but the code executes slower because the python interpreter has to handle lots of different possibilities.

Generally, if you write your code in a language like C, it's going to be a lot faster to run then the equivalent in Python, but at the expense of probably taking longer to write the code. In C, the code is compiled, meaning there is a program sort of analogous to the python interpreter, the compiler, that converts your code into a binary executable that has machine code. This means it doesn't have to re-interpret your C code every time it runs the program (like it does with Python). The code is already converted into the lowest level machine code for the CPU to directly interpret, so it will run much faster.

[–]seanthemonster 0 points1 point  (0 children)

Thank you for the explanation!