export_step_to_writer

Function export_step_to_writer 

Source
pub fn export_step_to_writer<W: Write>(
    content: &[u8],
    opts: &StepOptions,
    w: &mut W,
) -> Result<StepStats>
Expand description

export_step_with_stats, writing as it goes instead of returning the file. The two cannot drift: that one is this one writing into a Vec.

The gigabyte of String that doubled its way there is gone. What replaces it is not free: the entity index measures ~84 bytes a record, so 370 MB on 4.4 M records and ~1.1 GB on 16.8 M, before a byte is written. On a very large model it outweighs the output it stopped holding, and it is not removable – source order and the reference closure both need it.

out is buffered here, so a bare File is fine. A record costs two write calls, which unbuffered is two syscalls: measured 15.0 s against 4.3 s on 4.4 M records. A caller who already buffers pays one memcpy through 1 MiB.