Closed ronag closed 1 year ago
I'm not interested in micro optimizing some specific use case - JavaScript is a script and if you plan your data flow you can get decent IO perf with uWS. But the shortcomings of this script should not result in this library adding tons of hacks to avoid JavaScript behavior. After all you are scripting.
If these micro overheads are a problem then use C++, but these are not really low hanging fruits there are way way heavier problems in Node.js itself (we lose 70% perf in node.js 14 because of mistakes in nodejs)
All functions like writeStatus, writeHeader, write, send, should ideally be V8 fast calls but until Node.js camp exposes that API I cannot do anything about it. But even now, the overhead of calling into C++ is negligible compared to the overhead of calling into JS with node::MakeCallback. It's like day and night of a difference. You lose a drip going into C++ but you lose an entire ocean going into JS.
@uNetworkingAB Trying to raise the MakeCallback
issue again. https://github.com/nodejs/performance/issues/24
Do you have any benchmark script that can be used for reference in the discussion?
Currently, I'm doing this:
Which does a lot of js->cpp calls. Would it make sense to be able to do the following?