Skip to content

Comments

perf: reduce redundant array allocations in asset regex builder#6581

Merged
chenjiahan merged 2 commits intomainfrom
codex/optimize-performance-in-core-package
Nov 15, 2025
Merged

perf: reduce redundant array allocations in asset regex builder#6581
chenjiahan merged 2 commits intomainfrom
codex/optimize-performance-in-core-package

Conversation

@chenjiahan
Copy link
Member

Summary

  • replace chained map calls with a single pass loop in getRegExpForExts to avoid creating intermediate arrays when building the regex pattern

Testing

  • not run (not requested)

Codex Task

Copilot AI review requested due to automatic review settings November 15, 2025 02:36
@netlify
Copy link

netlify bot commented Nov 15, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 436f7ee
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/6917f128374aca0008d7b53e
😎 Deploy Preview https://deploy-preview-6581--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 62 (🔴 down 10 from production)
Accessibility: 97 (🔴 down 3 from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
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 optimizes the getRegExpForExts function by replacing chained .map() calls with a single loop to reduce intermediate array allocations during regex pattern building.

Key Changes:

  • Replaced two chained .map() calls with a single for...of loop that normalizes extension strings (trimming and removing leading dots) in one pass

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@chenjiahan chenjiahan merged commit c7da4f7 into main Nov 15, 2025
11 checks passed
@chenjiahan chenjiahan deleted the codex/optimize-performance-in-core-package branch November 15, 2025 03:24
@chenjiahan chenjiahan mentioned this pull request Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant