Repository navigation
Build the tryEnd return array in one call - #1329
Conversation
Interesting. One would think they would be identical since it's all in C++ and only sets entries in an Array, but apparently not. |
|
My thinking for the ideal architecture (as a side talk) is like this:
That way, you would isolate yourself from Node.js slowdowns as much as possible - your entire bottleneck becomes the V8 fastcall that just returns a uint32 and internally replaces the ArrayBuffer backing pointer. No GC involved at all. Literally zero GC allocations. Problem with this is, all the object-like abstractions become heavy weight (you need a way to lookup an Object from the uint32 which cannot be fastcall and kind of ruins the speedup). If you had an interface that did not treat the socket as an Object but kept it an Integer, all that loss is avoided but no one will accept such an interface and at that point you might as well swap away from Node.js. |
|
That interface is basically the C-like interface that the very first draft of uWS used. But nobody wanted an Object-less interface, they wanted heavy weight Objects that use GC allocations and so you're cooked from the start on that one. |
|
Thanks for merging. The reason is in V8's api.cc: The next small piece is #1330, one global handle less per request in |
Another small part of #1300, only the tryEnd change.
tryEnd returns
[ok, done]built withArray::New(2)and twoObject::Set. Each Set takes the generic property path, and when the chunk goes in the cork buffer this is more than half of the call.The fix builds the same array with one
Array::New(isolate, elements, 2).Measured on Node 26 win-x64, 1 byte chunks inside cork, min of 7 alternating runs: from 254 ns to 100 ns per call. Same return values and same body on both builds.