News for hackers. Stuff that matters.
Re:Functional PHP by ec109685 on Sunday October 13, 2024 @10:32AM (#41828350)
php has the opposite problem where if a script hangs on io, you can be cooked (assuming other requests blocked similarly).

Different trade offs for sure, but given IO is often the bottleneck, having it force you to think about running code asynchronously can often result in code that runs more in parallel than equivalent first blush php code.

For instance, if you were writing in a function style a program that fetched entries from a web service, for each of those results, run a summarization pass using another service, and then insert summarization result in a database, a style like shown in this article might serialize the summarization / insert operations, one after the other, where you’d instead want each result to be processed in parallel.

Lots of libraries in node that make that easy and the code straightforward to reason about.

There are no comments on this comment yet.