4 ms·
>Because Node.js is single threaded, background refreshing can tie up the CPU for an extended period of time (e.g., for CPU-intensive JSON parsing work), causin
by matthewaveryusa 11y ago
>Because Node.js is single threaded, background refreshing can tie up the CPU for an extended period of time (e.g., for CPU-intensive JSON parsing work), causing a spike in query response times.
I'm not the biggest node fan, but that is utterly false. How do you think asynchronous system calls get processed in libuv (the event loop that node uses.) ? threads. Of course you'll park the background thread while you're waiting in case of IO, but if it's CPU intensive then you bet that you can use all cores with background work. You just need to know how to write C++ and read the documentation on the bindings
- sciurus 11y agoWhy should they write it in JavaScript and C++ when they can write it in one language instead?
- matthewaveryusa 11y agoThey already have node which is a mix of javascript, C++ (v8) and c(libuv.) Go is a fine language, and it's ok to want to write infrastructure code in go, but they shouldn't be giving false reasons.
- sciurus 11y agoSure, node.js is implemented in multiple languages. But when people talk about writing code in node.js, they mean writing javascript. It's a javascript runtime, after all; it says so right on the front page of https://nodejs.org/en/ https://nodejs.org/en/ and even has js in the name. :-) Saying "of course node.js supports multiple threads of concurrent computation, you just have to write in c++ instead of javascript" is missing the point of why people use it.
- cdelsolar 11y agoHahah I wasn't sure if parent was trolling but it seemed like he wasn't...
- nailer 11y agoAren't there already C++ async JSON parsers in node anyway?