|
|
Log in / Subscribe / Register

NumPy 1.20 has been released

NumPy 1.20 has been released

Posted Feb 24, 2021 8:31 UTC (Wed) by quietbritishjim (subscriber, #114117)
In reply to: NumPy 1.20 has been released by ncm
Parent article: NumPy 1.20 has been released

Python will execute millions or even 10s of millions of instructions per seconds. (As the sibling comment points out, I am talking about the CPython runtime specifically.) Personally, that sounds very fast (in absolute terms) to me! Of course, you might disagree, since what counts as "fast" in absolute terms is so subjective. What is difficult to argue is that Python is slow relative to many other languages in common use. That's probably why the article author said "relatively slow", in the hope that the preciseness of that would avoid this whole discussion. Oh well.

On the note of speed and libraries like numpy, I'll point out that C libraries like numpy (and even some built in modules) release Python's global interpreter lock (GIL) while doing computations. So not only do they speed up the throughput in the current thread, they allow other threads to do work concurrently. (The GIL is also released when doing IO like reading from a file.)


to post comments

NumPy 1.20 has been released

Posted Feb 24, 2021 11:27 UTC (Wed) by thumperward (guest, #34368) [Link] (2 responses)

Yes, but very few people would argue that Python is slow relative to doing things with pencil and paper. For the vast majority of computing tasks, Python is plenty fast on contemporary hardware. But it is nevertheless the case that when one considers which contemporary languages Python is slow relative to, the answer is "nearly all of them". You wouldn't see a review of a car which had a top speed of 20mph described as "relatively slow" despite this being wildly better than foot speed.

NumPy 1.20 has been released

Posted Feb 24, 2021 12:05 UTC (Wed) by hkario (subscriber, #94864) [Link]

Except that Python does not manage 20mph in this analogy, it easily manages highway speeds. What it's not well suited for is winning Daytona 500.

NumPy 1.20 has been released

Posted Feb 24, 2021 13:51 UTC (Wed) by quietbritishjim (subscriber, #114117) [Link]

My point was that the terminology was probably chosen to avoid distracting comments about Python's speed instead of constructive comments about the article content. Your comment only reinforces that.

It's sadly a pattern on LWN articles about some new aspect of Python or its libraries: one of the top comments is about how slow Python is (often _the_ top comment, as in this case). It's one of the few times I wish LWN comments had Reddit style vote buttons. Not because I disagree, but just because it's off-topic and stifles more interesting discussions.

NumPy 1.20 has been released

Posted Feb 24, 2021 13:02 UTC (Wed) by pizza (subscriber, #46) [Link]

I recently replaced a relatively simple text parsing/collating python script with a nearly-identical one written in perl, and the runtime dropped from ~30s to ~3s.

(The original script was python 2, and I started out by trying to port it to python 3. Unfortunately it needed to handle sometimes-broken unicode so rewriting it in perl turned out to be far more expedient. And as it turned out, an order of magnitude faster)

Anectdotally, the only times I've seen where python is "fast" is when you're able to hand off batches of data to native-compiled libraries. (NumPy being a prime example of this..)


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds