4 ms·
> threads are strictly inferior as they have additional overhead by nature In terms of performance, sure. But performance is rarely your only priority. A lot o
by hbrn 4y ago
> threads are strictly inferior as they have additional overhead by nature
In terms of performance, sure. But performance is rarely your only priority. A lot of the times you already have existing code that can be switched to threads with 2 lines of code. Instead, folks choose to rewrite the whole app in asyncio/nodejs because threads aren't sexy. Hey, I've done it.
But today I'd rather have inferior working app in one day, than a completely rewritten app in a few weeks, with a mental model that half engineers don't understand and don't have experience with. Maybe in a few years you will be forced to rewrite it in asyncio. And that would be the right time to do it: when it's a business demand, not when few perfectionists are annoyed.
- gshulegaard 4y agoVery salient point. Having used both threading and various coroutine libraries (gevent prior to asyncio and asyncio more recently), I find coroutines easier to work with in modern versions of Python. So I don't find them superior strictly on performance; I also consider them more productive due to ease of use. But I wouldn't disagree with someone choosing to use threads because they find them easier to grok than asyncio.