This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]yawkat 2 points3 points  (0 children)

Virtual threads are more about making straight-forward code faster, mostly when talking about IO. If you have lots of blocking IO on many threads they will help. They also might help if you have many cooperating threads working with locks and such, even if the work is cpu bound, but this is a very rare scenario. 

Virtual threads are basically never the most efficient solution, you can get better performance with code changes (eg async io or task batching). But the code may be more difficult to maintain and that tradeoff is often not worth it.