GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: skip the Environment lookup when it is already known by nigrosimone · Pull Request #67833 · nodejs/node

Conversation

@nigrosimone

@nigrosimone nigrosimone commented Nov 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Follow-up of #66510, from the question in nodejs/performance#24 (comment) about places in Node that already have the Environment.

  • AsyncResource::MakeCallback() keeps env_, but went through InternalMakeCallback(isolate, ...), which looks up the Environment again from the creation context of the callback on every call. It now calls MakeCallbackInEnvironment(env_, ...), as Node-API does since node-api: find the Environment once #66509. This is the path of the addons that use node::AsyncResource.
  • Environment::CheckImmediate() called MakeCallback(env->isolate(), ...) with env in hand, now MakeCallback(env, ...).

The lookup removed is the same one #66510 saves for addons (133 -> 119 ns per call), so the AsyncResource row of benchmark/napi/make_callback should move the same way.

Disclosure: I used Opus 5.5 (Max) as coding assistant

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Nov 27, 2026
@nigrosimone nigrosimone mentioned this pull request Nov 27, 2026
MakeCallback is very slow nodejs/performance#24
Open
@nigrosimone
src: skip the Environment lookup when it is already known
8c5027b
Signed-off-by: Nigro Simone <[email protected]>
@nigrosimone
nigrosimone force-pushed the async-resource-env branch from ef5fd79 to 8c5027b Compare November 27, 2026 18:29
@codecov

codecov Bot commented Nov 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.52%. Comparing base (7ed1ca0) to head (8c5027b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67833      +/-   ##
==========================================
+ Coverage   90.51%   90.52%   +0.01%     
==========================================
  Files         805      805              
  Lines      285878   285879       +1     
  Branches    55200    55199       -1     
==========================================
+ Hits       258756   258786      +30     
+ Misses      17214    17200      -14     
+ Partials     9908     9893      -15     
Files with missing lines Coverage Δ
src/api/async_resource.cc 83.01% <100.00%> (ø)
src/env.cc 84.20% <100.00%> (-0.06%) ⬇️

... and 29 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@nigrosimone @nodejs-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.