3 ms·
>"It's a premature optimization that makes coding and debugging more difficult." Going multi-threaded and dealing with semaphores and mutexes also makes coding
by xiaoma 11y ago
>"It's a premature optimization that makes coding and debugging more difficult."
Going multi-threaded and dealing with semaphores and mutexes also makes coding and debugging more difficult. It's all about trade-offs.
- qihqi 11y agoGenerally true. Though, in context of webapps, each thread usually works on one request. If your threads share (mutable) states in that case then something is VERY broken.
- daxfohl 11y agoKind of, but consider logging. In node you can just console.log. In JVM you have to use a multi threaded logging library or your logs could be jumbled. Lots of things like that.
- sievebrain 11y agoThose aren't the only ways to write thread safe code, just the oldest ways. Also, remember that you can have unexpected re-entrancy at any callback boundary in the fully async model. It is not a panacea.