Skip to main content

DEFAULT_TOKEN_LIMIT

Constant DEFAULT_TOKEN_LIMIT 

Source
pub const DEFAULT_TOKEN_LIMIT: usize = 20_000_000_000;
Expand description

The runaway-token BACKSTOP’s baseline: real runaways are cut far earlier by the cycle guards / pushback limit / byte budget, so erring high costs no detection latency. The heaviest measured legit arXiv paper is math0402448 (amsart + xy-pic, 80.2M end-of-run progress under the 2026-06-10 all-three-reader-loop accounting; the old “80M” figure predated that multi-counting) and the former 400M ceiling was 5× that — but the TeX Live doc corpus goes higher with NO loop: tikzlings-doc (scrartcl, ~250 raw-pgf animal pictures through tcolorbox listings, each box typeset twice) completes at a measured 444.5M (Debug:gullet:progress, 2026-09-01, 30 KB main source so the per-byte scaling never engaged), and finite O(n²) macro work goes further still: circularglyphs-sample (xstring \StrSubstitute ×34 over 600-char phrases, ~2.5G) and source2e (l3doc crossrefs over 46k codelines, ~2G) both COMPLETE under LATEXML_TOKEN_LIMIT=0 within the 300 s budget where Perl times out, yet died at the former 1G with a false “infinite loop?”. 4G; raised, never lowered (a genuine loop is still bounded — by this ceiling, by the --timeout wall clock, by the cycle guards, and by the RSS cap). LATEXML_TOKEN_LIMIT overrides (0 disables). Book-scale sources raise it proportionally per conversion — see scale_token_limit_to_source. 20e9 = the 300 s sweep wall at the measured 65 M tok/s ceiling: at 4e9 the backstop fired at 61 s on lie-hasse’s legitimate E8 poset figure (completes at ~8e9 in 124 s with a 304 KB picture; pdflatex 83 s) and mislabelled it “infinite loop” with a 39-byte XML. True loops are still bounded by the wall clock, the cycle guards and the RSS cap.