Skip to content

Minor perf cleanups in the build ID-finalization pipeline #150

Description

@uhyo

Small, non-urgent efficiency cleanups in the build pipeline (fine at current scale, cheap to fix):

  • topologicalSort (packages/static/src/build/dependencyGraph.ts): cycle detection uses sorted.includes(node) inside a loop — O(n²). Use a Set of sorted nodes.
  • ID replacement (rscProcessor.ts and replaceIdsInContent in buildApp.ts): each content string gets one replaceAll pass per mapped ID, i.e. O(components × mappings) full-string scans. A single pass with one alternation regex over all mapped IDs (temp IDs are UUID-based, so safe to escape and join) would make it linear.

Found during a framework audit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions