2 ms·
> ALSO: Your example is much slower than the same server written in Node.js, haha. Because the language doesn't support evented programming. The language may be
by gpderetta 9y ago
> ALSO: Your example is much slower than the same server written in Node.js, haha. Because the language doesn't support evented programming. The language may be fast, but the paradigm of blocking while waiting for I/O is slow!
there are plenty of event libraries for C++, many predating Node.js (which is written in C++ btw) by decades.
There is no reason why the op example can't be implemented on top of such a library.
Unless your was sarcasm, in which case Poe's law strikes again.
- EGreg 9y agoThat may be true, but his example is not evented programming. Unless the function he is calling is badly named, I am pretty sure the style he was thinking about was about blocking the thread until I/O completed.
- gpderetta 9y agoI can't know what the OP had in mind, but I don't see anything that would prevent the example to be fully asynchronous. http::repsonse could be the moral equivalent of a future or it could be running on top of a coroutine.