Skip to main content

parse_parallel_with

Function parse_parallel_with 

Source
pub fn parse_parallel_with(
    input: &[u8],
    options: ParseOptions,
    threads: usize,
) -> Result<ParseOutcome, StepError>
Expand description

Parses on up to threads threads, returning exactly what parse_with returns for the same input and options: the same exchange, the same diagnostics in the same order, the same error.

threads <= 1 parses sequentially. Splitting pays off on large inputs only – each thread starts with a fresh allocator arena and the merge is a move per record – so callers should parse small files (below a few megabytes) with parse_with directly.

Worst case: when a split point turns out not to be a record boundary for the parser, the parallel work is discarded and the file is parsed again sequentially, costing up to one extra sequential parse.

§Errors

Exactly the errors of parse_with.