Live data from Hacker News

gh-116167: Allow disabling the GIL

github.com

171–180 of 259 posts

Re: gh-116167: Allow disabling the GIL

#171
post #37

Earlier quoted context omitted.

I wish I had your optimism. Thoughtless bandwagon-y "criticism" is extraordinarily persistent.

There's no need to pretend Python has virtues which it lacks. It's not a fast language. It's fast enough for many purposes, sure, but it isn't fast, and this work is unlikely to change that. Fast er , sure, and that's great.

"Faster, sure" seems unnecessarily dismissive. That's the whole point of all this work.

Re: gh-116167: Allow disabling the GIL

#172

I've been programming in Python for over 6 years now and every week I learn something new. But recently I've been thinking about moving to a more capable language with proper concurrency for backend API requests (FastAPI sucked). I also want types, so Elixir is not in the picture. I dabbled in Rust a bit. Although I was able to get the hang of things and build a CLI tool pretty quickly, I'm worried I'll have to deal…

GoLang as others suggested is a good pick. If you're in the "I don't like coloured functions" camp it's likely your best bet for web workloads.

If you're not a fan of GoLang's spartan syntax and are cool with async/await, C#/dotnet core is a great experience on all platforms. IMO it has the best async/await implementation (it originated there) on top of a multi-threaded event loop. ASP.NET is a great web framework and it has great library support for everything else. As someone who avoids "traditional" ORMs (Hybernate, Django) I really like Dapper.

Re: gh-116167: Allow disabling the GIL

#173
post #105

Earlier quoted context omitted.

There's no need to pretend Python has virtues which it lacks. It's not a fast language. It's fast enough for many purposes, sure, but it isn't fast, and this work is unlikely to change that. Fast er , sure, and that's great.

This is entirely fair, and I wish I'd been a little less grumpy in my initial reply (I assign some blame to just getting over an illness). Thank you for the gentle correction! That said - I think it's fair to be irritated by people who write Python off as entirely useless because it is not _the fastest_ language. As you rightly say - it's fast enough for many purposes. It does bother me to see Python immediately coun…

It’s all about values.

I have been on teams where Python based approaches were discounted due to “speed” and “industry best practice” and then had the very same engineers create programs that are slow by design in a “fast” language and introduce needless complexity (and bugs) through “faster” database processes.

Like you said, it’s the thoughtless criticism. The meme. I am happy for Python to lose in a design analysis because it’s too slow for what we are building; I am loathe to let it lose because whoever is doing the analysis with me has heard it’s slow.

Which is to say, I get what you’re saying. I think people have been a little ungenerous with your comment.

Re: gh-116167: Allow disabling the GIL

#174
post #49

Earlier quoted context omitted.

And I guess what I don't understand is why people choose Python for these use cases. I am not in the "Rustify" everything camp, but Go + C, Java + JNI, Rust, and C++ all seem like more suitable solutions.

Why do people use python for anything beyond glue code? Because it took off, and machine learning and data science now rely on it. I think Python is a terrible language that exemplifies the maxim "worse is better". https://en.wikipedia.org/wiki/Worse_is_better

To quote from Eric Raymond's article about python, ages ago:

"My second [surprise] came a couple of hours into the project, when I noticed (allowing for pauses needed to look up new features in Programming Python) I was generating working code nearly as fast as I could type.

When you're writing working code nearly as fast as you can type and your misstep rate is near zero, it generally means you've achieved mastery of the language. But that didn't make sense, because it was still day one and I was regularly pausing to look up new language and library features!"

Source: https://www.linuxjournal.com/article/3882

It doesn't go for large code bases, but if you need quick results using existing well tested libraries, like in machine learning and data science, I think those statements are still valid.

Obviously not when you're multiprocessing, that is going to bite you in any language.

Re: gh-116167: Allow disabling the GIL

#175
post #143

Earlier quoted context omitted.

Not in single threaded code.

Umm, yes it does? For the longest time, Guido’s defense for the GIL was that all previous efforts resulted in an unacceptable hit to single threaded performance. Read PEP-703 ( https://peps.python.org/pep-0703/#performance ) where the performance hit is currently 5-8%

That's to make it thread safe without the GIL.

If you only care about single thread there's all kinds of stuff you can do.

Re: gh-116167: Allow disabling the GIL

#176
post #173
post #105

Earlier quoted context omitted.

This is entirely fair, and I wish I'd been a little less grumpy in my initial reply (I assign some blame to just getting over an illness). Thank you for the gentle correction! That said - I think it's fair to be irritated by people who write Python off as entirely useless because it is not _the fastest_ language. As you rightly say - it's fast enough for many purposes. It does bother me to see Python immediately coun…

It’s all about values. I have been on teams where Python based approaches were discounted due to “speed” and “industry best practice” and then had the very same engineers create programs that are slow by design in a “fast” language and introduce needless complexity (and bugs) through “faster” database processes. Like you said, it’s the thoughtless criticism. The meme. I am happy for Python to lose in a design analysi…

> I think people have been a little ungenerous with your comment.

Eh - I engaged with a fraught topic in a snarky way without clarifying that I meant the unintuitive-but-technically-literally-accurate interpretation of my words. Maybe some people have been less-generous than they could have been, but I don't begrudge it - if I look sufficiently like a troll, I won't complain when I get treated like one. Not everyone has the time and mental fortitude to treat everyone online with infinite patience and kindness - I know I sure don't.

Thank you for the support, though!

Re: gh-116167: Allow disabling the GIL

#177

ELI5 I get in concept what the GIL is. But what's the impact of this change? Packages will now break, for the hope of better overall performance?

Previously people basically didn't bother to write multithreaded Python at all due to the GIL. Threads were primarily used when you had multiple pieces of work to do which could end up blocked on independent I/O. Which is common and useful of course, but doesn't help with the performance of CPU-bound Python code. Even outside of high-intensity CPU work, this can be useful. A problem lately is that a lot of code is wr…

Will this also support threads spanning multiple cores, or is that unrelated?

Edit: https://peps.python.org/pep-0703/ suggests it will support multiple cores, unless the current work does not yet achieve that.

Re: gh-116167: Allow disabling the GIL

#178

ELI5 I get in concept what the GIL is. But what's the impact of this change? Packages will now break, for the hope of better overall performance?

If any package depends on the GIL, it will be enabled. Packages won't break

What packages might depend on the GIL and why would they need it?

Re: gh-116167: Allow disabling the GIL

#179
post #36

More than seeing it in main, I'm happy for the "python thread slow" meme officially going away now.

I doubt that Python will ditch the meme. The fundamental model of dynamic dispatch using dictionaries on top of a byte code interpreter is pretty slow. I wouldn't expect it to get within 2x of JavaScript.

Re: gh-116167: Allow disabling the GIL

#180

Earlier quoted context omitted.

And I guess what I don't understand is why people choose Python for these use cases. I am not in the "Rustify" everything camp, but Go + C, Java + JNI, Rust, and C++ all seem like more suitable solutions.

> but Go + C, Java + JNI, Rust, and C++ all seem like more suitable solutions. apart from go (maybe java) those are all "scary" languages that require a bunch of engineering to get to the point that you can prototype. even then you can normally pybind the bits that are compute bound. If Microsoft had been better back in the say, then c# should have been the goto language of choice. It has the best tradeoff of speed/h…

[deleted]
Post reply on HN