2 ms·
In new code I try to use threads, but certain things like yield which rely on async are simply too common and useful to stop using. So far in production if I n
by trollbridge 2y ago
In new code I try to use threads, but certain things like yield which rely on async are simply too common and useful to stop using.
So far in production if I need to use multiple cores, I use multiple processes and design apps that way. The discipline this imposes does seem to result in better apps than I wrote in an environment like Java with tons of threads.
- bhouston 2y ago> In new code I try to use threads, but certain things like yield which rely on async are simply too common and useful to stop using. Huh? I python you have to choose either threads or asynchronous/await? Why not combine both of them? I am so confused. C# allows for both to be combined quite naturally. And JavaScript as well allows for workers with async/await.
- elcomet 2y agoWhat do you mean? Async/await uses threads
- bhouston 2y agoI was trying to make sense of this sentence of the original commenter: "In new code I try to use threads, but certain things like yield which rely on async are simply too common and useful to stop using." Seems to suggest that threads and yield/async were mutually exclusive. I misunderstood. I will move on.
- te_chris 2y agoTo use async await you have to execute the code in a run loop.
- nwatson 2y ago... and you can push CPU-intensive stuff off to a thread-executor to avoid blocking the async run-loop
- trollbridge 2y agoThey aren't mutually exclusive, but are two basically independent features. The way you would code for one and the other is completely different.