Skip to content

feat(pack): napi add pluginRuntimeStratefy type#2677

Merged
xusd320 merged 2 commits into
nextfrom
add-pluginRuntimeStrategy-napi
Mar 11, 2026
Merged

feat(pack): napi add pluginRuntimeStratefy type#2677
xusd320 merged 2 commits into
nextfrom
add-pluginRuntimeStrategy-napi

Conversation

@fireairforce

Copy link
Copy Markdown
Member

Summary

add a napi type for turbopack-node to control runtime strategy.

Test Plan

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the configuration capabilities of the packing process by adding a new option to control the runtime strategy for NAPI plugins within Turbopack-node. This allows for explicit selection between workerThreads and childProcesses, providing greater flexibility in how plugins are executed.

Highlights

  • NAPI Plugin Runtime Strategy: Introduced a new type, pluginRuntimeStrategy, to the ConfigComplete interface, enabling the selection of plugin runtime execution methods between "workerThreads" and "childProcesses" for Turbopack-node.
Changelog
  • packages/pack-shared/src/config.ts
    • Added pluginRuntimeStrategy property to the ConfigComplete interface.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds a new pluginRuntimeStrategy option to the configuration, allowing control over the runtime strategy for plugins. The change itself is correct, but the corresponding JSON schema in packages/pack/config_schema.json should also be updated to include this new property for validation and autocompletion. Additionally, there is a minor typo in the pull request title ('Stratefy' should be 'Strategy').

importSource?: string;
};
stats?: boolean;
pluginRuntimeStrategy?: "workerThreads" | "childProcesses";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This new configuration option should also be added to the project's JSON schema. Please update packages/pack/config_schema.json to include pluginRuntimeStrategy. This ensures that users benefit from validation and autocompletion for this new setting in their configuration files.

@github-actions

Copy link
Copy Markdown

📊 Performance Benchmark Report (with-antd)

Utoopack Performance Report (Intelligent)

Report ID: utoopack_performance_report_20260311_043247
Generated: 2026-03-11 04:32:47
Trace File: trace_antd.json (0.6GB, 3.35M events)
Test Project: examples/with-antd


Executive Summary

Key Findings

Metric Value Assessment
Total Wall Time 8,390.7 ms Baseline
Total Thread Work (de-duped) 27,465.0 ms Non-overlapping busy time
Effective Parallelism 3.3x thread_work / wall_time
Working Threads 5 Threads with actual spans
Thread Utilization 65.5% 🆗 Average
Total Spans 1,674,316 All B/E + X events
Meaningful Spans (>= 10us) 565,437 (33.8% of total)
Tracing Noise (< 10us) 1,108,879 (66.2% of total)

Workload Distribution by Tier

Category Tasks Total Time (ms) % of Thread Work
P0: Runtime/Resolution 0 0.0 0.0%
P1: I/O & Heavy Tasks 39,619 3,765.1 13.7%
P3: Asset Pipeline 35,623 3,280.3 11.9%
P4: Bridge/Interop 0 0.0 0.0%
Other 490,195 22,735.0 82.8%

🤖 AI Intelligent Attributions

New section mapping granular tasks to bottlenecks.

Top 10 Batching Candidates

These highly-called tasks are dominated by a single parent. If the parent can batch them into one call, it drastically reduces scheduler overhead.

Task Name Count Top Caller (Attribution) Avg P95 Total Time
analyze ecmascript module 36,722 process module (76%) 100.4 us 0.28 ms 3,687.8 ms

Top 20 Tasks by Total Duration

Total (ms) Count Avg (us) P95 (ms) Max (ms) % Work Task Name Top Caller
8,363.7 206,932 40.4 0.1 12.3 30.5% module write all entrypoints to disk (1%)
4,146.5 70,173 59.1 0.1 194.6 15.1% process module module (16%)
3,687.8 36,722 100.4 0.3 193.4 13.4% analyze ecmascript module process module (76%)
2,780.6 24,667 112.7 0.4 109.4 10.1% code generation chunking (6%)
1,959.5 68,515 28.6 0.0 7.7 7.1% resolving module (29%)
1,790.5 63,925 28.0 0.0 9.6 6.5% internal resolving resolving (31%)
1,337.4 14,678 91.1 0.2 41.5 4.9% chunking write all entrypoints to disk (0%)
1,299.7 30,942 42.0 0.1 13.2 4.7% precompute code generation code generation (32%)
1,065.8 8,611 123.8 0.1 227.8 3.9% write all entrypoints to disk None (0%)
1,046.9 13,082 80.0 0.4 106.9 3.8% compute async module info chunking (0%)
1,016.9 8,058 126.2 0.5 69.1 3.7% parse ecmascript analyze ecmascript module (26%)
566.8 10,743 52.8 0.1 41.8 2.1% compute async chunks compute async chunks (0%)
286.9 1,937 148.1 0.4 17.5 1.0% generate source map code generation (96%)
65.5 2,165 30.3 0.0 4.0 0.2% read file parse ecmascript (91%)
65.0 674 96.4 0.0 18.2 0.2% compute binding usage info write all entrypoints to disk (0%)
57.1 201 283.8 0.5 21.1 0.2% make production chunks chunking (2%)
51.8 1,877 27.6 0.0 7.2 0.2% collect mergeable modules compute merged modules (0%)
34.1 14 2434.0 10.2 11.0 0.1% apply effects write all entrypoints to disk (7%)
32.8 13 2520.4 10.2 11.0 0.1% write file apply effects (100%)
30.2 5 6045.2 18.7 21.1 0.1% compute merged modules make production chunks (100%)

Duration Distribution

Range Count Percentage
< 10us (noise) 1,108,879 66.2%
10us - 100us 538,945 32.2%
100us - 1ms 22,011 1.3%
1ms - 10ms 4,390 0.3%
10ms - 100ms 85 0.0%
> 100ms 6 0.0%

Action Items

  1. [P0] Use Batching Candidates to pinpoint specific files needing try_join or reduced #[turbo_tasks::function] limits.
  2. [P1] Inspect P95 (ms) for heavy monolith tasks. Focus on long-tail outliers rather than averages.

Report generated by Intelligent Utoopack Performance Analysis Agent

@xusd320 xusd320 merged commit 7cf1298 into next Mar 11, 2026
21 checks passed
@xusd320 xusd320 deleted the add-pluginRuntimeStrategy-napi branch March 11, 2026 04:49
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