perf: a full CSS syntax memo stops memoizing, so per-route stylesheet passes re-split the same selectors (asset_writes, 56-page import)
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- css, php
- Ambito
- performance, testing, tooling
Direzione di ricerca
Inspect CssRuleTreeCache::memo() and the callers CssStylesheetTransformer::splitSelectorList() and CssSelectorTokenizer::tokenize(). The relevant flow is compose.site_plan.asset_writes, SitePlanRun::finalStylesheets(), and RouteStylesheetDeliveries::specialize(); verify the cache generation reset preserves the budget and output. Run the parity fixtures and the contract test described in the issue, checking that a full memo still stores the next source without exceeding its limit.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
CssRuleTreeCache::memo() backs the compiler's flat CSS syntax memos: CssStylesheetTransformer::splitSelectorList(), CssSelectorTokenizer::tokenize() and others. Once its budget is full (65,536 entries, 524,288 scalars or 16 MiB), it stops storing new results and keeps the entries that filled it.
Those first entries come from early compose steps. Later steps work on different selectors. In compose.site_plan.asset_writes, SitePlanRun::finalStylesheets() and RouteStylesheetDeliveries::specialize() run several passes over every stylesheet, and specialize() repeats those passes for each route's copy of a stylesheet. By then the memo is full, so every pass splits and tokenizes the same selector lists again. Each split is a byte scan of a long projected selector list.
Evidence: Wix site, 56 pages, php-transformer v0.52.42 (2f89a38)
I ran a standalone ArtifactCompiler::compose() on the retained Static Site Importer shared plan and 56 compiled receipts, profiled with excimer:
compose.site_plan.asset_writestook 233 s of a 1,543 s compose.finalStylesheetstook 117 s andspecializetook 85 s. Inputs at that point: 1,005 CSS assets (34.5 MB).RouteStylesheetDeliveries::specialize()alone, on its captured inputs, made 1,839,645splitSelectorList()calls over 42,239 distinct preludes. 729,899 of them missed the memo and re-split 164 MB of selector text. The memo held only 19,243 entries: their 16 MiB byte budget was full.- Across the whole compose, memo misses (
CssRuleTreeCache::memoinclusive) cost 937 s of 3,266 s on a loaded host.splitSelectorListUncachedtook 499 s andtokenizeUncachedtook 207 s.
Fix (generic, output-preserving)
When an entry would exceed the budget, clear the memo and start a new generation, instead of refusing the entry. The memo stays bounded by the same budgets, and the entries it keeps are the recent ones that later passes read again. Results are pure functions of the variant and source bytes, so output cannot change.
Prototype on the real inputs: specialize misses drop from 729,899 to 66,813. The composed result JSON is byte-identical (sha256 c78816ce…f4290).
Acceptance
- The composed output is identical on real inputs, and the parity fixtures are unchanged.
- A contract test shows that a memo filled to its entry budget still memoizes the next source, and that it never holds more than the budget.
Not in scope: CssSyntaxScanner::matchingClose() walks a group one byte at a time through consume(), where matchingBrace() skips inert runs with inertEnd(). That cost is separate (~80 s of asset_writes here).
AI disclosure: Claude (Anthropic) via Pi/Roadie subagent profiled this and drafted the issue for Chris Huber.
- Lingua principale
- PHP
- Stelle
- 31
- Fork
- 7
- Merge medio
- 5h 48m
- PR unite (30g)
- 796
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Automattic/blocks-engine
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Automattic/blocks-engine#4943 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Automattic/blocks-engine#4942 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Automattic/blocks-engine#4921 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Automattic/blocks-engine#775 ·
I maintainer di solito rispondono entro 1 giorno
-
Full-post listings never become query loops: literal-field alignment compares whole post bodies across cardsForse già presa @chubes4 l’ha presa oggi. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
Automattic/blocks-engine#7652 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Automattic/blocks-engine
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
recca0120/vscode-phpunit#620 ·
I maintainer di solito rispondono entro 1 giorno
-
Validation rule generation for recursive Data objects is unbounded (O(payload depth))Forse già presa @irfanm96 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
spatie/laravel-data#1226 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno