3 ms·
He was not benchmarking concurrency, he was pointing out that Node is single-threaded system that essentially implements the old-style cooperative multitasking,
by lobster_johnson 15y ago
He was not benchmarking concurrency, he was pointing out that Node is single-threaded system that essentially implements the old-style cooperative multitasking, where a single task will block everything else. He could have used sleep() and it would have illustrated the same point (and more elegantly, since half of the responses miss the point entirely and focus on the Fibonacci part).
Node developers probably don't do a lot of computationally complex stuff, but when they do, they have to think about the concurrency problem. Even something as trivial as sorting a large list or parsing a huge chunk of JSON is going to stop all other requests from executing.
- gvb 15y agoBut he isn't benchmarking web server concurrency because he is doing a single curl $ time curl http://localhost:8000 165580141 real 0m0.016s user 0m0.007s sys 0m0.005s So he is running the Fibonacci (40) once with the web server. The only concurrency / parallelism that is happening is in the recursive Fibonacci algorithm. I stand by my contention that the Fibonacci algorithm is a very poor test of concurrency / parallelism. I stand by my contention that he should have implemented an algorithm that could be solved in concurrent pieces and then benchmarked node.js against his favorite language. If the algorithm cannot be parallelized effectively, it doesn't matter how many tasks you spawn to solve it (cooperative or otherwise), the algorithm's dependencies will cause all the tasks to block and effectively serialize their execution.
- lobster_johnson 15y agoI'm referring to the original post (http://teddziuba.com/2011/10/node-js-is-cancer.html http://teddziuba.com/2011/10/node-js-is-cancer.html), which did test concurrency. The Haskell guy missed the point entirely and seems to have given up after Haskell is shown to memoize his function.