|
|
|
|
|
by DanWaterworth
5135 days ago
|
|
Hi, I work at a company that makes heavy use of event loops. I'll try to accurately convey what I know: From an efficiency standpoint, using event loops requires much less memory, but marginally more CPU time than threaded approaches. In terms of maintenance, you're essentially writing your programs in continuation passing style which means error handling is explicit everywhere. There are tools that allow you to hide this like streamlinejs, Haskell's continuation monad transformer and to a lesser degree, promises/futures/deferrables. If you decide to stick with callback passing, then a good knowledge of functional programming is useful as all loops require recursion. If your application is single threaded, that tends to make finding race conditions easier, but on the whole I'd say it's harder to write good asynchronous code than it is to write good synchronous code. |
|