7 ms·
"NodeJS isn’t really functional, but if everything’s a callback and you’re single threaded, who cares?" Anyone could elaborate on what this actually means?
by morkbot 13y ago
"NodeJS isn’t really functional, but if everything’s a callback and you’re single threaded, who cares?"
Anyone could elaborate on what this actually means?
- mrich 13y agoJavascript does not have threads, so the only way to use it on the server with decent multiuser performance is with async I/O and callbacks. So he's saying people are using NodeJS because it made it possible to write server-side apps, regardless of its other features.
- SideburnsOfDoom 13y agoOne of the benefits of "really functional" code is that without lots of side-effects and mutable state, it is easy to parallelise things. But if "you’re single threaded" as node.js is, you aren't going to get those benefits anyway, s it doesn't matter. There are performance benefits to the asynchrony that node.js's callbacks give you - i.e. the single thread that you have doesn't block waiting for things to complete and can handle other requests in the meantime. But this isn't really parallelisation.