Skip to main content

DEADLINE_CHECK_INTERVAL

Constant DEADLINE_CHECK_INTERVAL 

Source
pub const DEADLINE_CHECK_INTERVAL: u64 = 64;
Expand description

How many Budget::safepoint calls pass between checks of the wall clock when a deadline is set.

Instant::now() reads a monotonic clock, which on most platforms is a system call or vDSO trap — several orders of magnitude slower than decrementing an integer. Checking it at every safepoint would tax fuel-heavy loops for a bound that fuel usually enforces anyway. Every DEADLINE_CHECK_INTERVALth call keeps the wasted overrun bounded to a small, fixed number of safepoints without paying the clock’s cost on every one. When no fuel limit is set, nothing else bounds the run, so the clock is consulted on every call regardless of this constant.