Skip to main content

PATIENCE

Constant PATIENCE 

Source
pub const PATIENCE: Duration;
Expand description

How long to give a form before abandoning it, when there is no better number to hand.

One second, against release measurements on an M5 Pro: the reference form — every node kind this toolkit has, in nine and a half kilobytes — parses in under 3 ms, and the other five forms in the repository in under 300 µs each. So this is three hundred times the slowest real form, and still short enough that a person reads the pause as slow rather than as hung.

It is a default rather than a rule, and Form::parse_within takes the number as an argument for two reasons. A file near MAX_SOURCE is legitimately slower than this — four megabytes of real nodes measures 1.7 s, and ten times that unoptimised — so a program that generates enormous forms has to say so. And the machines this toolkit is for are not the machine those numbers came off: the margin above is there to be spent, and a panel that finds it is not enough should ask for more rather than go without.