Decide whether one loader may run another refinement pass.
Two rules, both from measured bytes:
a HARD STOP once tracked residency is already at or past the ceiling, and
a PREDICTIVE stop when the next rung would cross it.
Rule 2's input comes from estimateNextRungBytes, which under-estimates
on purpose for the ladder shape that actually hurts. A geometric ladder may
cross the ceiling by one level before its pass stops. Admissions reserve
their estimate immediately, and measured post-pass bytes replace it before
the next loader is considered. Over-estimating here would stop equal-count
ladders several rungs early, degrading scenes that were never in danger.
Production construction supplies a device-class fallback when
performance.memory is unavailable, so Firefox and Safari are budgeted too.
The non-positive branch is defensive for direct callers that explicitly supply
no usable budget; it admits everything rather than treating invalid input as
exhausted capacity.
Decide whether one loader may run another refinement pass.
Two rules, both from measured bytes:
Rule 2's input comes from estimateNextRungBytes, which under-estimates on purpose for the ladder shape that actually hurts. A geometric ladder may cross the ceiling by one level before its pass stops. Admissions reserve their estimate immediately, and measured post-pass bytes replace it before the next loader is considered. Over-estimating here would stop equal-count ladders several rungs early, degrading scenes that were never in danger.
Production construction supplies a device-class fallback when
performance.memoryis unavailable, so Firefox and Safari are budgeted too. The non-positive branch is defensive for direct callers that explicitly supply no usable budget; it admits everything rather than treating invalid input as exhausted capacity.