You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
astro.config.mjs calls buildNoindexPredicate() while Astro loads the config. Astro loads the config in a module graph that is separate from the page modules, so the cached memo in src/lib/registry.ts is not shared. compileRegistry therefore runs once for the config and once for the pages.
Instrumenting compileRegistry and running npx astro build prints the marker twice.
Why it matters
One compileRegistry() call on the real data takes about 2.65 s and materialises 86,397 records. The duplicate pass adds that time and a second in-memory copy to every build and to every astro dev start.
Suggested fix
Build the predicate lazily inside the sitemap filter callback, or share one compiled registry between the config and the pages.
Found during review of #127. Not caused by that PR.
Fixed on staging by 4d1c708 (#139). The memo moved to globalThis under Symbol.for('textrefs.compiledRegistry'), the one scope both of Astro's module graphs share. Instrumented builds confirm 2 compiles → 1, with 259,812 pages both times.
The fix ships with the v0.1.0 release, #4. Closing now rather than at the tag, because the change is on staging and Closes does not fire from a merge into a non-default branch.
Activity
perf(site): compile the registry once per build, not twice
perf(site): compile the registry once per build, not twice (#139)
maehr commentedon Sep 2, 2026
Fixed on
stagingby4d1c708(#139). The memo moved toglobalThisunderSymbol.for('textrefs.compiledRegistry'), the one scope both of Astro's module graphs share. Instrumented builds confirm 2 compiles → 1, with 259,812 pages both times.The fix ships with the
v0.1.0release, #4. Closing now rather than at the tag, because the change is onstagingandClosesdoes not fire from a merge into a non-default branch.