Skip to content

perf(turbopack): use trace_span in tracing::instrument, improve by 1x - #2469

Merged
xusd320 merged 1 commit into
nextfrom
perf/tracing-span
Dec 30, 2025
Merged

perf(turbopack): use trace_span in tracing::instrument, improve by 1x#2469
xusd320 merged 1 commit into
nextfrom
perf/tracing-span

Conversation

@xusd320

@xusd320 xusd320 commented Dec 30, 2025

Copy link
Copy Markdown
Contributor

Follow #2468

Improve tracing span in next.js

  • Before:
image
  • After:
image

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @xusd320, 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 focuses on optimizing the tracing instrumentation within Turbopack by adjusting the verbosity of several tracing spans. By downgrading these spans from the INFO level to the TRACE level, the change aims to improve performance by reducing the default logging overhead, allowing for more detailed diagnostics only when explicitly needed. Additionally, it includes an update to the next.js subproject.

Highlights

  • Tracing Level Adjustment: The pull request updates several tracing spans from info_span! to trace_span!, effectively changing their default logging verbosity from INFO to TRACE.
  • Performance Optimization: This change is a performance improvement, as indicated by the perf prefix in the title, by reducing the overhead of tracing for less critical operations that are now captured at a finer-grained trace level.
  • Next.js Subproject Update: The next.js subproject has been updated to a newer commit, reflecting upstream changes or dependencies.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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 improves performance by changing several info_span! macro calls to trace_span!. This is a good optimization as it reduces tracing overhead in default configurations by moving these spans to a more verbose tracing level.

I've made a few suggestions to improve consistency in how trace_span! is used across the modified files. By importing the macro at the top of each file, the code becomes more uniform and slightly easier to read.

Overall, the changes are correct and effectively address the goal of improving performance.

Comment thread crates/pack-api/src/paths.rs
output_assets: OperationVc<OutputAssets>,
) -> Result<()> {
let span = tracing::info_span!("emitting");
let span = tracing::trace_span!("emitting");

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

For consistency with other files in this PR (e.g., crates/pack-api/src/app.rs), consider importing trace_span at the top of the file and using it directly without the tracing:: prefix. This would make the style for using tracing spans uniform across the codebase.

// at the top of the file
use tracing::{Instrument, trace_span};

// ...

// here
let span = trace_span!("emitting");

Comment thread crates/pack-core/src/library/chunking_context.rs
@xusd320 xusd320 changed the title perf(turbopack): use trace_span in tracing::instrument perf(turbopack): use trace_span in tracing::instrument, improve by 1x Dec 30, 2025
@xusd320
xusd320 merged commit 172cd7a into next Dec 30, 2025
21 checks passed
@xusd320
xusd320 deleted the perf/tracing-span branch December 30, 2025 06:47
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