top | item 34900675

(no title)

demindiro | 3 years ago

For an I/O heavy application (not in C++) I avoid threads for the main "loop" as there is a central cache that is accessed often. Synchronizing access to it is likely more expensive and error-prone than using just a single thread. It is also possible a few hundred or thousand tasks are running concurrently, which becomes very expensive very quickly with threads.

There are a few CPU-intensive tasks but those are easy to isolate and send to a threadpool.

discuss

order

No comments yet.