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.
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 usessorted.includes(node)inside a loop — O(n²). Use aSetof sorted nodes.rscProcessor.tsandreplaceIdsInContentinbuildApp.ts): each content string gets onereplaceAllpass 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.