Skip to content

perf(core): reuse dynamic import function in CJS runner - #8525

Merged
chenjiahan merged 2 commits into
mainfrom
chenjiahan/perf-reuse-cjs-dynamic-import
Sep 22, 2026
Merged

chenjiahan merged 2 commits into
mainfrom
chenjiahan/perf-reuse-cjs-dynamic-import

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Motivation

The CommonJS runner creates an identical new Function('specifier', 'return import(specifier)') for every uncached output module it executes, although the function has no per-module state.

Changes

Create the function once in createCjsRequirer() and reuse it across modules handled by that requirer. This avoids repeated function construction while preserving native dynamic imports in the main context.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-22T11:04:32.076753Z d0e883c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed31a3c149

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core/src/server/runner/cjs.ts Resolved
@chenjiahan
chenjiahan merged commit bc78604 into main Sep 22, 2026
7 checks passed
@chenjiahan
chenjiahan deleted the chenjiahan/perf-reuse-cjs-dynamic-import branch September 22, 2026 13:09
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

⌂ 换网址