4 ms·
That doesn't make your code faster though. For a particular bit of single threaded computation the async approach is going to be slower due to context switchin
by rjbwork 5y ago
That doesn't make your code faster though. For a particular bit of single threaded computation the async approach is going to be slower due to context switching overhead. Same in C#, Rust, etc. If your performance is I/O bound, then, as I said, it enables greater scalability by allowing computation to continue on other contexts while waiting for that I/O operation.
- davidkunz 5y agoYes, this is absolutely correct. I don't think anyone would argue that async code makes CPU-bound computations faster, the opposite is the case because you have naturally more overhead.