Is today's python faster than 20 years ago's Fortran or C?

It is said that python is 100 times slower than C. But is the hardware improvement more than 100 times in the past 20 years? If so, today’s python would be comparable with 20 years ago’s C. That is still enough for many jobs.

1 Like

Python and C/C++ are not really competitors, in my opinion, since they aim at very different kind of programs. If someone needs to write code that needs to support high-throughput and be super fast, then they shouldn’t use Python (at least not CPython) – except perhaps as initial prototype to port to C or Rust later. If you want to write a high-level ML framework – like pytorch – then Python is ideal – it’s ideal as glue code that delegates all the hard work to low-level C libraries.

You gotta remember that as hardware improves, the programs written in C also becomes faster, not just Python or some other language. That said, Python is constantly improving it’s performance and is getting faster. Not because of hardware specifically, but because the language is getting optimized over time and employs more advanced techniques.
But if you want to to get Python as fast as possible, you should probably use PyPy instead of CPython.

Only if you try to implement low-level algorithms with integers and characters and refuse to use any of the high level functions written in optimised C ! For a great many use cases there are very fast packages available for Python so it is only slow in certain cases, and rarely 100 times slower than the equivalent C program.