Skip to content

Conversation

Copy link

Copilot AI commented Jan 23, 2026

Several utility helpers were doing avoidable per-call work (regex construction, linear key scans) in hot paths. This update reduces repeated work while preserving behavior.

  • HTML escape/unescape fast path
    • Hoist maps and regex creation to module scope and reuse during replacements.
  • Object filtering efficiency
    • Use Set membership for pick/exclude to avoid repeated linear scans.
  • Behavior coverage
    • Add duplicate-key cases to validate pick/exclude semantics.
const ESCAPE_REGEX = new RegExp(`(${Object.keys(ESCAPE_MAP).join('|')})`, 'g')
return text.replaceAll(ESCAPE_REGEX, (match) => ESCAPE_MAP[match])
Original prompt

Identify and suggest improvements to slow or inefficient code


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 23, 2026

Deploying vue-mdc with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1044e83
Status: ✅  Deploy successful!
Preview URL: https://362b4196.components-7fj.pages.dev
Branch Preview URL: https://copilot-improve-slow-code-ef.components-7fj.pages.dev

View logs

Copilot AI changed the title [WIP] Identify and suggest improvements to slow code performance Optimize hot-path utility helpers for string escape and object filtering Jan 23, 2026
Copilot AI requested a review from obillekyle January 23, 2026 01:54
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