2 ms·
the point was that putting any $computationally_expensive_fn in your event loop was a terrible idea. in this case he then did $computationally_expensive_fn = f
by mindstab 15y ago
the point was that putting any $computationally_expensive_fn in your event loop was a terrible idea.
in this case he then did
$computationally_expensive_fn = fib;
the point is, unless this event loop pretty much does nothing or hands off the work to a pool and returns immediately, it is utterly unscalable and needs a multiplexer to sit infront of it.
most servers do
while(1) {
$conn = accept_conn();
new EventThread($conn);
}
Thus it's simply multiplexed. Alternately most current other web languages take the approach of integrating with apache which does this one level [up/down?] and they don't have to worry about it at all.
The point is you can write safer code in other languages even if it is slower by it self. With node.js you can do some really dangerous things if you go it alone. You must deploy node with something else, but that's kind of an after thought left up to the dev, and loads won't because they are all under the mistaken impression that because node.js is faster than php/python etc that alone solves all problems and excuses them from sane scalable coding practices. At best it just puts it off a little further down the road. And anything built into a webserver doesn't have to worry, while node will.