Repository navigation
Keep onData, onDataV2 and onWritable callbacks in MoveOnlyFunction inline storage - #1325
Conversation
|
Measured with the benchmark workflow proposed in #1326: this branch against master, both built on the same hosted runner, the load alternating between them (nigrosimone#2). Every row stays inside the noise band of the run, so at this resolution the change moves nothing in either direction, which is expected: one allocation per registration is well under a percent of a request.
"Noise" is how far base against base and head against head, the same code on both sides, got from 1.0 in the same run; a row is marked only when it moved more than that. Node v26.9.0, AMD EPYC 7763, 4 cores, wrk -t2 -c100. |
|
Btw, this seems like a bug in V8. |
|
Yes, I agree. In the same V8 headers |
|
Close here. PR on v8 https://chromium-review.googlesource.com/c/v8/v8/+/8467989 |
|
I am following your third party fixes, they are well received but I am fully exhausted with the Node.js core people so I try and stay out of their shit |
First part of #1300, only the NoexceptPersistent change.
v8::Globalhas a move constructor that is notnoexcept, so every lambda that captures aUniquePersistentfails theis_small_object_vtest in MoveOnlyFunction and is heap allocated, even when the capture is only 16 bytes (the handle plus the isolate pointer). That is onenewand onedeleteperonData,onDataV2andonWritableregistration.The fix is a small wrapper that restores the
noexcepton the move (the underlying move is a pointer swap and cannot throw), used in those three sites.onAbortedandcollectBodycapture more than 16 bytes and are left as they are.Checked with a static_assert on
ofats::any_detail::is_small_object_vfor a lambda capturingUniquePersistent(false) andNoexceptPersistent(true), compiled with MSVC against the Node 26 headers.