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

Show parent comments

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/Armaliite Nov 13 '20

The reference implementation is in C, but there are many other implementations. For example PyPy which is in the benchmarks and is also much faster than CPython.