4 ms·
From the conclusion of the article: > If you need to get a few URLS fast, a ThreadPoolExecutor is likely the Pareto solution, 99% of the time. I agree with th
by js2 3y ago
From the conclusion of the article:
> If you need to get a few URLS fast, a ThreadPoolExecutor is likely the Pareto solution, 99% of the time.
I agree with this. ThreadPoolExecutor is easy to use. In general, using threads in Python to handle concurrent I/O is pretty simple and plenty performant.
- zo1 3y agoOr just use an async Http client with a little asyncio snippet. Depends on what you're comfortable with and what code you have running already. If you're a junior and have no clue, your best bet is to ask a senior in your team though.
- plonk 3y agoIt’s a waste if you need coordination between the tasks though. Putting an async task aside and sending only dumb synchronous function calls that never wait is more efficient than blocking a thread while it waits on another. asyncio with an executor is a good way to run complex tasks in parallel.
- prometheon1 3y agoI'm not sure whether this was your intention, but I think you are in full agreement with the article.