Skip to content

[WIP] perf: call node::MakeCallback with the Environment taken once in serve() - #4

Draft
nigrosimone wants to merge 1 commit into
Moro-JS:mainfrom
nigrosimone:makecallback-env
Draft

nigrosimone wants to merge 1 commit into
Moro-JS:mainfrom
nigrosimone:makecallback-env

Conversation

@nigrosimone

@nigrosimone nigrosimone commented Nov 26, 2026 •

Copy link
Copy Markdown

DO NOT MERGE

serve() takes the Environment once with node::GetCurrentEnvironment() and keeps it in JsServer. The request callbacks pass it to the new node::MakeCallback(Environment*, ...) overload of nodejs/node#66510, so Node does not look it up from the callback on every call. In the benchmark of that PR it is 133 -> 119 ns per call.

Draft until nodejs/node#66510 lands and ships. The NODE_MAJOR_VERSION >= 27 guard is a placeholder, I will set the first version that has the overload. Older versions keep the current call.

@nigrosimone nigrosimone changed the title perf: call node::MakeCallback with the Environment taken once in serve() [WIP] perf: call node::MakeCallback with the Environment taken once in serve() Nov 26, 2026

This branch has not been deployed

No deployments
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.

1 participant