Skip to content

perf(@angular/build): deduplicate PostCSS dir-dependency glob scans across stylesheets - #34430

Closed
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:perf/postcss-dir-dependency-glob-cache
Closed

alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:perf/postcss-dir-dependency-glob-cache

Conversation

@alan-agius4

@alan-agius4 alan-agius4 commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Cache in-flight and resolved PostCSS dir-dependency glob() promises per ${dir}\0${globPattern} key within StylesheetPluginFactory and across instances sharing a LoadResultCache, clearing the cache when cache.invalidate() or cache.clear() is called.
  • Prevents redundant concurrent directory scans across component stylesheets (e.g., when using Tailwind CSS).
  • Added unit tests in stylesheet-plugin-factory_spec.ts verifying watchFiles resolution, cache reuse across stylesheets and shared LoadResultCache instances, and cache invalidation.

Benchmark (ngwr)

Metric main Branch Delta
Runs (ms) 11751, 11867, 11505, 11662, 11921 11908, 11740, 11728, 11545, 11738
Median (ms) 11751 ms 11738 ms -0.11%
Mean (ms) 11741 ms 11732 ms -0.08%
Min (ms) 11505 ms 11545 ms 0.35%

…cross stylesheets

Cache in-flight and resolved PostCSS `dir-dependency` `glob()` promises per `${dir}\0${globPattern}` key within `StylesheetPluginFactory` and across instances sharing a `LoadResultCache`, clearing the cache on invalidation. This prevents redundant concurrent directory scans across component stylesheets (e.g., with Tailwind CSS).
@angular-robot angular-robot Bot added area: performance Issues related to performance area: @angular/build labels Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: @angular/build area: performance Issues related to performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant