4 ms·
Think of Python as a way to script C, and skip most/all compiling. If your Python is slow, you are probably doing it wrong. Recommend reading this: https://cer
by punnerud 3y ago
Think of Python as a way to script C, and skip most/all compiling. If your Python is slow, you are probably doing it wrong.
Recommend reading this:
https://cerfacs.fr/coop/fortran-vs-python https://cerfacs.fr/coop/fortran-vs-python
- IshKebab 3y agoNot all Python is just a front-end to fast C code. That only really works with numerical computing of big tensors. Though I'd still agree - if your Python is slow you're doing it wrong - you shouldn't be using Python!
- punnerud 3y agoIf you switch away from Python, you are probably sub optimizing
- eru 3y agoThere are reasons other than speed that makes people move away from Python. Btw, recently CPython has sped up a lot. Between versions 3.9 to 3.12 many programs run about twice as fast. Much of that improvement is thanks to the 'faster-cpython' project (which Microsoft is generously funding). I contributed about a 1% speedup during that time, too.
- eru 3y agoYou can also call eg Rust or OCaml code from Python, doesn't have to be C.
- IshKebab 3y agoOf course. When people talk about calling C from Python they really mean "a fast language".
- 7734128 3y agoI was a teaching assistant in a "data structures and algorithms" course where students could choose either Java or Python. Most of the labs were the same except that the treemap lab had to become a hashmap lab for the Python version because it was so excruciatingly slow.
- vitiral 3y agoIf you want to see C's _true_ scripting language, check out Lua. It can be embedded in your C application, unlike Python which is the other way around (Lua is like 80KiB, Python is several MiB).