Hacker News new | ask | show | jobs
by jon_richards 934 days ago
One thing I love about block_on is that it has a dedicated threadpool with a ton of threads. For async code, you want around as many threads as cores so the thread can run at full speed and have the scheduler handle switching, but for block_on, most of the time is sleeping, so the core can just switch between them all and take care of any that are done sleeping. Just don't use it for CPU intensive tasks.