Skip to content

perf: inline is_absolute check with comment at resolve call sites#8437

Merged
hyf0 merged 4 commits intoperf/reduce-path-allocationsfrom
copilot/sub-pr-8435
Feb 24, 2026
Merged

perf: inline is_absolute check with comment at resolve call sites#8437
hyf0 merged 4 commits intoperf/reduce-path-allocationsfrom
copilot/sub-pr-8435

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 24, 2026

  • Inline resolve_file_from_importer in crates/rolldown_resolver/src/resolver.rs with comment, remove helper function
  • Inline resolve_file_from_importer (2 call sites) in crates/rolldown_plugin_vite_resolve/src/resolver.rs with comment, remove helper function
  • Restore accidentally removed doc comment on infer_module_def_format
  • Verify compilation

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add functions for clearer optimization intent perf(resolver): extract resolve_file_from_importer helpers to clarify optimization intent Feb 24, 2026
Copilot AI requested a review from hyf0 February 24, 2026 06:11
Copilot AI changed the title perf(resolver): extract resolve_file_from_importer helpers to clarify optimization intent perf: inline is_absolute check with comment at resolve call sites Feb 24, 2026
}
}

/// Infer module format from file extension and package.json type field
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot Why are you removing this comment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry about that — it was accidentally removed when deleting the helper function block above it. Restored in e18d03d.

Copilot AI requested a review from hyf0 February 24, 2026 12:14
@hyf0 hyf0 marked this pull request as ready for review February 24, 2026 14:49
Copilot AI review requested due to automatic review settings February 24, 2026 14:49
@hyf0 hyf0 merged commit 28562e1 into perf/reduce-path-allocations Feb 24, 2026
5 checks passed
@hyf0 hyf0 deleted the copilot/sub-pr-8435 branch February 24, 2026 14:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR applies a small performance-oriented refactor in the resolver paths by inlining the “absolute importer” fast-path at resolve call sites and documenting the intent, while also restoring the infer_module_def_format doc comment.

Changes:

  • Inline the is_absolute check at resolve call sites to avoid allocating via join when the importer is already absolute.
  • Remove the resolve_file_from_importer helper (verified no remaining references).
  • Restore the doc comment on infer_module_def_format.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
crates/rolldown_resolver/src/resolver.rs Adds an is_absolute fast-path when resolving with an importer and keeps infer_module_def_format documentation.
crates/rolldown_plugin_vite_resolve/src/resolver.rs Adds the same is_absolute fast-path at both resolve call sites in the Vite resolver implementation.

@github-actions
Copy link
Copy Markdown
Contributor

Benchmarks Rust

  • target: perf/reduce-path-allocations(51016de)
  • pr: copilot/sub-pr-8435(e18d03d)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.06     72.1±3.15ms        ? ?/sec    1.00     68.2±2.05ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.00     74.9±1.62ms        ? ?/sec    1.00     74.6±2.04ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00     97.8±3.35ms        ? ?/sec    1.02     99.8±2.49ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    108.3±2.34ms        ? ?/sec    1.01    109.4±1.90ms        ? ?/sec
bundle/bundle@threejs                                        1.02     36.4±2.16ms        ? ?/sec    1.00     35.7±0.82ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     39.7±0.60ms        ? ?/sec    1.03     40.9±1.06ms        ? ?/sec
bundle/bundle@threejs10x                                     1.02    365.3±5.94ms        ? ?/sec    1.00    357.7±5.84ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.01    410.6±7.60ms        ? ?/sec    1.00    407.9±7.45ms        ? ?/sec
scan/scan@rome_ts                                            1.02     77.0±2.31ms        ? ?/sec    1.00     75.1±1.47ms        ? ?/sec
scan/scan@threejs                                            1.00     27.3±0.53ms        ? ?/sec    1.01     27.4±1.28ms        ? ?/sec
scan/scan@threejs10x                                         1.00    274.3±4.30ms        ? ?/sec    1.00    273.5±5.69ms        ? ?/sec

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.

3 participants