News for hackers. Stuff that matters.
Re:Loops in Python – Comparison and Performance by dotdi on Thursday August 08, 2019 @12:29PM (#20645976)
The article is interesting but not for the face value.

On the surface, the comparison is rather weak because it is comparing loops in a dynamic language to optimized, low-level vector operations. Which is, you know, "whoa, low-level hand-optimized routines are faster than Python", or, as I said, weak.

The interesting bit is that Python cannot figure out that it could unroll or vectorize these, rather simple, operations. Surely there are languages with optimizers that can figure that out. Is that impossible to do in Python? Is that by design or by accident?

And, as many people said, if you are doing a lot of math in pure Python, you are doing it wrong. There are other, much more useful, ways to use loops. I like Python especially because it beautifully handles those "other cases".

Re:Loops in Python – Comparison and Performance by anentropic on Thursday August 08, 2019 @12:49PM (#20646154)
that would be https://pypy.org/ I guess
Re:Loops in Python – Comparison and Performance by gmiller123456 on Thursday August 08, 2019 @01:44PM (#20646711)
On the surface, the comparison is rather weak because it is comparing loops in a dynamic language to optimized, low-level vector operations. Which is, you know, "whoa, low-level hand-optimized routines are faster than Python", or, as I said, weak.

I'm not sure where you're trying to go with that, but comparing Python's interpreted, non-optimized speed to low level OMG optimized code is exactly the point of the article.

The comparison is very useful for anyone looking to increase the speed of code they've written in Python. This points out the limits of what can be achieved in pure Python, and where you'd need to look to improve things, even if it means rewriting the whole thing in a different language. From what you've said, it sounds like you were expecting an article on something different.

Re:Loops in Python – Comparison and Performance by BerislavLopac on Friday August 09, 2019 @08:41AM (#20653739)
> The comparison is very useful for anyone looking to increase the speed of code they've written in Python.

Python has numerous mechanisms that are much more efficient than the solution in this artice, like zip, map and filter functions, as well as the excellent built-in libraries like itertools and functools.