News for hackers. Stuff that matters.
Re:Python 3.11 vs 3.10 performance by soperj on Wednesday July 06, 2022 @11:58AM (#32002844)
When you only have so many hours to go around, you concentrate on the main goals.
Re:Python 3.11 vs 3.10 performance by atwood22 on Wednesday July 06, 2022 @12:53PM (#32003628)
My point is that you can write fast code just as easily as you can write slow code. So engineers should write fast code when possible. Obviously you can spend a lot of time making things faster, but that doesn't mean you can't be fast by default.
Re:Python 3.11 vs 3.10 performance by jjnoakes on Wednesday July 06, 2022 @01:46PM (#32004357)
> you can write fast code just as easily as you can write slow code

I think some people can do this and some can't. For some, writing slow code is much easier, and their contributions are still valuable. Once the bottlenecks are problems, someone with more performance-oriented skills can help speed up the critical path, and slow code outside of the critical path is just fine to leave as-is.

If you somehow limited contributions only to those who write fast code, I think you'd be leaving way too much on the table.

Re:Python 3.11 vs 3.10 performance by gus_massa on Wednesday July 06, 2022 @02:50PM (#32005179)
You usually need more tricks for fast code. Bubble sort is easy to program (it' my default when I have to sort manually, and the data is has only like 10 items)

There are a few much better options like mergesort or quicksort, but they have their tricks.

But to sort real data really fast, you should use something like timsort, that detects if the data is just the union of two (or a few) sorted parts, so it's faster in many cases where the usual sorting methods don't detect the sorted initial parts. https://en.wikipedia.org/wiki/Timsort

Are you sorting integers? Strings? Ascii-only strings? Perhaps the code should detect some of them and run an specialized version.

Re:Python 3.11 vs 3.10 performance by int_19h on Wednesday July 06, 2022 @04:15PM (#32006227)
This isn't true in general, and it is especially not true in the context of language interpreters / VMs.
Re:Python 3.11 vs 3.10 performance by zo1 on Wednesday July 06, 2022 @02:29PM (#32004902)
Being fast requires effort. It's not always about raw performance of the language yo use, it's about using the right structures, algorithms, tradeoffs, solving the right problems, etc. It's not trivial and I've seen so many bad implementations in "fast" compiled languages.
Re:Python 3.11 vs 3.10 performance by otherme123 on Wednesday July 06, 2022 @02:37PM (#32005003)
Not true. Premature optimization is the root of all evil. You first write clean code, and then you profile and optimize. I refer you to the underlyings of dicts through the years (https://www.youtube.com/watch?v=npw4s1QTmPg) as an example of that optimization taking years of incremental changes. Once you see the current version it's easy to claim that you would have get to the current and best version in the first place, as obvious as it looks in hindsight.
Re:Python 3.11 vs 3.10 performance by gpderetta on Thursday July 07, 2022 @06:24AM (#32012144)
CPython and the Python design in general clearly show that writing clean code and optimizing later is significantly harder and take much more effort than keeping optimizations in mind from the start. It doesn't mean you need to write optimal code form day one, just that you need to be careful not to program yourself into a corner.