Performance
Understand the cache, write-skipping, changed-only mode, and bounded concurrency.
registry-build is optimized for repeated local runs. Warm builds should avoid touching unchanged files, avoid re-reading unchanged source content unnecessarily, and report real rewritten file counts in the summary table.
What is optimized
The current performance model focuses on five things:
- file-hash caching
- skip writing identical files
- incremental index and component rebuilds
- bounded concurrent work
- changed-only local rebuild mode
Cache location
By default the builder writes cache state to:
<output.dir>/.registry-build/build-cache.json<output.dir>/.registry-build/build-cache.jsonOverride it with:
performance: {
cacheDir: '.registry-build',
}performance: {
cacheDir: '.registry-build',
}The cache directory is local build state and should stay ignored by Git.
How warm builds work
On warm runs the builder:
- reuses cached file hashes when mtime and size are unchanged
- reuses cached index entries when signatures match
- reuses cached component payload decisions when signatures match
- skips component-index and colors writes when generated output is unchanged
- removes stale generated files when previous outputs disappear from the current build
--changed-only
Use this flag when you know you are doing a local iterative rebuild and want the builder to lean on the cache aggressively:
registry-build build --changed-onlyregistry-build build --changed-onlyPair it with explicit changed paths when you know which files moved:
registry-build build --changed-only --changed ../../packages/registry-ui/src/button/button.tsxregistry-build build --changed-only --changed ../../packages/registry-ui/src/button/button.tsxThat lets the builder narrow component rebuild work to affected registry items instead of checking every generated payload equally.
--changed-only is most useful in editor-driven or watcher-driven local workflows. CI should usually run a full build.
Parallelism
The builder uses bounded concurrency for discovery and generation work. The default is Math.max(1, Math.min(cpuCount, 8)) — CPU-aware and capped at 8.
Override it with:
performance: {
parallelism: 6,
}performance: {
parallelism: 6,
}Use a lower number if your workspace lives on slower storage or if the generated outputs compete with another heavy process.
When files are rewritten
The builder rewrites files only when their generated content changes.
That applies to:
index.json- per-item component JSON files
- generated component index files
- colors/theme JSON files
- generated
themes.css
On a true no-op warm build the summary table should usually show Files as - for every phase.
Turning incremental mode off
performance: {
incremental: false,
}performance: {
incremental: false,
}Do that only when you need to debug cache behavior or compare with a fully uncached build. The normal default should stay on.
Troubleshooting
Warm builds still rewrite files
Check whether generated content is actually stable. Dynamic timestamps, non-deterministic ordering, or unstable custom generators will force rewrites even when source files did not change.
changed-only still rebuilds more than expected
Make sure the changed paths you provide map closely to the real source files that belong to a registry item. File-indexed sources can narrow work more precisely than folder-level item indexing.
Where did .registry-build come from?
That is the local incremental cache directory under output.dir. It is expected, safe to delete, and should be ignored by Git.