Skip to content

reverse_complement spends most of its time reading input #43

Closed
@mbrubeck

Description

@mbrubeck

On my system, reverse_complement < input25000000.txt spends 67% of its time on the read_to_end call here. According to the profile, that time is almost all spent in memmove.

    let mut data = Vec::with_capacity(1024 * 1024);
    stdin.lock().read_to_end(&mut data).unwrap();

Increasing the initial buffer size to fit the entire dataset cuts the read_to_end time in half, and reduces the total execution time by about 30%, but obviously it also wastes memory if the data is small. (Since this program reads from stdin, it doesn't known the total size before it starts reading.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions