r/Python • • Nov 13 '20

News Python swallows Java to become second-most popular programming language

https://www.theregister.com/2020/11/12/python_swallows_java_to_become/
2.3k Upvotes

205 comments sorted by

View all comments

585

u/[deleted] Nov 13 '20

C is #1 according to this article, if anyone wants the TL;DR.

A quote at the end that I found interesting:

"And Python's 'slowness' is overstated. Who cares about some other language that's a few nanoseconds faster if you spend hours (or days or weeks) trying to figure out how to use it? A human's time is more valuable than a computer's."

I think this quote just about sums up the creator's POV on other languages, specifically Java. I don't think he's really comparing Python to something like C/C++ because those languages will run circles around Python with more than just "nanosecond" margins if used properly. Not to mention other languages like C/C++ are mature and are used to build projects that last for decades, even longer. I still see companies struggling to move their technologies from Python2 to Python3 due to it's end of support.

I love Python and use it often, but in certain fields people have to care about speed, performance and stability. Sometimes it's a matter of life and death. I wouldn't even trust Java for those types of tasks tbh let alone Python. It's easy to learn and use and it's fast enough to do most tasks that people need, but I still think languages like C/C++ are superior.

20

u/mrsmiley32 Nov 13 '20

Hmm, I feel like someone should have already have done language benchmarks in a way that you could do a code review so that you could create a PR in case they screwed up a language setting.

Oh a quick Google presents many, here's one.

https://github.com/kostya/benchmarks

10

u/ChickenNuggetSmth Nov 13 '20

I'd take that benchmark with a huge grain of salt. I had a quick look at the matmul in python, and what they did was pretty bad: They reimplemented what is already efficiently written.

In python you can have dramatic performance improvements if you use the available fast libraries like numpy. They are written in a faster language like fortran, decreasing the python performance overhead by a ton while still providing the convenience of python.

5

u/kazi1 Nov 13 '20

That's the whole point though. You're not testing Python's speed if you use numpy, you're testing C. The benchmarks would just be every language using C libraries if that was allowed.

4

u/ChickenNuggetSmth Nov 13 '20 edited Nov 13 '20

To preface this: I'm not super knowledgeable about what happens "behind the scenes" or even if numpy is considered a standard library or not.

I think libraries like numpy are the reason python is as good as it is. It is well integrated, for matrix multiplication you even have the @ operator that makes it super readable. If you benchmark python without those features, you are not representing a typical use-case. If you use python in a way it was never meant to be used it will look awful, but imo those results are pretty useless.

Edit: I'm seeing that numpy isn't part of the standard library, but the standard lib is also partially written in C. So I'm not sure where 'true' python starts.

1

u/kazi1 Nov 13 '20

Yeah a fair point. I feel like these benchmarks can get pretty "handwavy" sometimes with what's allowed and what's not haha...

Tbh I'm surprised Rust performed as badly as it did in those stats - I thought it was supposed to be as fast as C, meanwhile it's almost neck and neck with Go.