Skip to main content

MAX_PASTE_BYTES

Constant MAX_PASTE_BYTES 

Source
pub const MAX_PASTE_BYTES: usize = _; // 67_108_864usize
Expand description

Upper bound on the bytes one p / P may insert, counting the count prefix’s multiplication. A count can request terabytes (yy then 999999999p), so a bound has to exist; what it must not do is refuse an ordinary large yank.

Measured on the batched paste path (release, Linux; glibc and mimalloc within noise of each other): peak RSS is linear in payload at ~3.1x charwise, ~4.1x linewise and ~2.9x blockwise, and independent of document size. At this value a paste costs ~208 MiB peak and ~73 ms charwise, an order of magnitude under the 2 GiB ceiling the weekly cron fuzz job runs with — under that ceiling the batched path only aborts past a 448 MiB payload. It also matches hjkl_fs::read::BODY, so pasting is no longer stricter than opening a file of the same size.

The 1 MiB this replaced was derived from the pre-batching implementation, whose cost tracked iteration count rather than payload bytes.