enc only.Expand description
The build-time encoder’s thread budget.
Public because the proc macro sits above the codecs and has its own
independent work – one derive compresses every file in a folder – and
the budget only bounds the machine if all three levels draw on the same
one. Nothing here is reachable from dec.
Compression runs once, on the machine doing the build, inside a proc macro. Decompression runs in every consumer’s shipped binary, and never reaches this module. So the encoder is free to use every core the build machine has, and the only real question is how to divide them between work that nests: one derive compresses many files, each file may try several codecs, and one codec may split its input into blocks.
A single budget answers that. Each level asks for as many extra workers as it has independent work, takes whatever is left, and hands them back when it is done, so the three levels together never oversubscribe.
Functions§
- map
parallel-encode - Apply
fto every item, in parallel where the budget allows.