Skip to content

Keep the onAborted capture in MoveOnlyFunction inline storage - #1331

Merged
uNetworkingAB merged 1 commit into
uNetworking:masterfrom
nigrosimone:onaborted-noexcept-persistent
Sep 28, 2026
Merged

uNetworkingAB merged 1 commit into
uNetworking:masterfrom
nigrosimone:onaborted-noexcept-persistent

Conversation

@nigrosimone

Copy link
Copy Markdown
Contributor

Follow-up of #1325 and #1330.

After #1330 the onAborted lambda captures res and the isolate, 16 bytes, but UniquePersistent has no noexcept move, so MoveOnlyFunction still puts it on the heap on every call. Capturing res as NoexceptPersistent, like onData and onWritable do since #1325, keeps it inline.

Measured on master, Node 26 win-x64, min of 7 alternating runs: res.onAborted from 80 ns to 45 ns per call. Same behaviour on both builds: only the last callback fires, res throws after the abort, the callback survives a gc, and 2000 of 2000 res objects are collected after end.

@nigrosimone
nigrosimone marked this pull request as ready for review September 28, 2026 17:58
@uNetworkingAB
uNetworkingAB merged commit 073f974 into uNetworking:master Sep 28, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants