Repository navigation
Conversation
nc9
force-pushed
the
fix/page-budget-hint-first-1445
branch
2 times, most recently
from
October 31, 2026 19:12
0f4c572 to
817c947
Compare
…nder or tail takes page budget #1445 Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
fix/page-budget-hint-first-1445
branch
from
October 31, 2026 19:59
817c947 to
d4e0ba6
Compare
Merged
Contributor
Author
|
Landed in v0.0.152 as nik |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1445.
With the page budget full (512 KB in the cloud), a small early script's whole remainder used room that a later bundle's windows around its vendor literal needed.
createBundleSampler(content, headChars)(new,packages/tech-detect/src/bundle-sample.ts) classifies the body and finds the hint windows once, then answerssample(maxChars, windowsOnly).sampleBundleExtrasis unchanged in behaviour (windows then tail).buildTechInputspass 2 (packages/audit-engine/src/technologies.ts) runs in steps over all of the page's bundles: windows only at 2 KB, 8 KB, then the full 24 KB per bundle, then the remainder or tail. A bundle's held windows are given back and re-chosen each step with the room left; the last step never drops windows a windows-only step chose.min(6 KB, a quarter)), and the final step keeps the windows a windows-only step chose, so a window-heavy bundle still sends its tail.windowScanAllowances): the smallest bundles first, each given its whole length when that is within an equal share of what is left, the rest sharing the remainder, at least 64 KB each. A bundle that does not fit its share is searched in the start of it (windows from that prefix, no tail), never skipped; a single huge body gets the whole 12 MB. The hint search and the lower-cased copy read only the searched prefix. A bundle is not scanned for windows when under 420 bytes of room is left, but the last step still scans for a tail of 32 bytes or more.tech-extras-budget-1420.test.tsandextras-budget-1420.test.ts): 25 scripts at the page cap with the loader in the last bundle's window; 21 scripts; a loader in an early small script's remainder still found; five window-heavy bundles then a late one (rounds); exact accounting; held room given back; a window-heavy bundle keeps its tail, at the sampler and at page level (8 KB of extras, reserve of 2 KB); the allowances (within the cap, small bundles whole, equal shares, a single huge body gets its share, a floor for 400 bundles); six 3 MB bundles with the loader 0.8 MB into the last; an 18 MB body with a loader 2 MB in; 40 bundles of 600 KB where a loader past the share is not searched; a tail under 420 bytes is sent; the sampler's scan prefix. Mutants that fail a test: no tail reserve in the windows step (sampler and page level), no 2 KB / 8 KB rounds, full charge instead of the delta, no give-back, no scan cap, no prefix passed to the sampler, the 420-byte rule applied to the tail. The sampler lives in a function, so there is no explicit clear to drop.Skill: no change needed.
nik