3 ms·
> Today, with the global interpreter lock, only one of those threads can be executing bytecode at a time. Yes, but Python now has a version without GIL, which
by shlomo_z 2y ago
> Today, with the global interpreter lock, only one of those threads can be executing bytecode at a time.
Yes, but Python now has a version without GIL, which prompted this post in the first place. So my question is: Now, if I use a version of Python 3.13 without GIL, can a threaded Flask app do better than an AIOHTTP server.
- elashri 2y agoI think it will depend on which task we are talking about. For For CPU-bound tasks (i.e heavy computation, data processing), The No-GIL Flask with threading would likely perform better than AIOHTTP since it can truly parallelize computation across cores.Now for I/O-bound tasks (database queries, API calls or file operations) then AIOHTTP would still likely be more efficient due to its lower overhead and memory. So for your original question > Is threading potentially better for IO bound tasks than async? async will be better in general, potentially due to Async co-routines using far less memory than threads and being better under high concurrency. But that's all will depend on the details of implementation of the server.