r/ProgrammerHumor • • Aug 26 '20

Python goes brrrr

Post image
59.2k Upvotes

789 comments sorted by

View all comments

Show parent comments

1

u/[deleted] Aug 26 '20

... and if it doesn't need to be fast. Language speed often doesn't matter, but if it's a factor, Python is going to be a problem.

1

u/mxzf Aug 26 '20

Which isn't to say that Python is particularly slow, it's just not as optimized for speed as you can make some languages. For 99% of code that needs to be written, Python's speed is perfectly sufficient.

1

u/Kered13 Aug 27 '20

I mean, it's pretty much the slowest popular language. The main reason for this is because CPython doesn't use a JIT. It's still a great language and I love it for small projects.

1

u/[deleted] Aug 27 '20

Python is terrifically slow, about 1/20th the speed of C. Contrast that with, say, Java, which is about 1/2 the speed of C, or C#, which is only a hair behind that. Most of the languages that compile down to LLVM, like Rust, end up somewhere in that range as well, often a little faster than Java. Rust is optimized carefully enough that it's quite close to C.

With many classes of problems, you're I/O bound, not compute bound, so using a slow language doesn't matter. You can still process the data faster than the input source can provide it. But once the speed of the program becomes the problem, instead of the speed of storage or network, then Python's slow throughput can become a big deal.