How do you decide to use async or single/multithreading?

51 points RunnableReddit

Hola Amigos,

for other languages than rust I've always been on the camp to use async/await as soon as anything IO-related happens.
But especially with rust I'm starting to doubt that line of reasoning, reasons being:

  1. File IO usually still runs sync, just in a thread pool. Pure overhead in many cases
  2. Async code in general can be more painful to write
  3. Async code always has performance overhead, even with real async.

Don't get me wrong, it is still a very useful tool, in case you really need it (doing thousants to millions of IO related things, e.g. a webserver) but for small console programs I don't see how it can benefit it so the overhead is worth it.

But I'm starting to regret using async in cases like this.
I think I will start using threads more if I don't need to handle that many things at once. It is also kinda nice to have a thread with it's own routine dedicated to one thing only..

How do you decide to use async or threads? It's kind of a blurred line of when it could be worth using