Skip to content

std::process::Command::output is unacceptably slow #108223

Closed
@safinaskar

Description

@safinaskar

std::process::Command::output is unacceptably slow. Consider this code:

https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=333b57442699553257f0273bb1bba3ac

When trying this code, make sure you have enabled release mode. On my local machine I see this output:

1565 ms
100000000
103 ms
100000000

So std::process::Command::output is 15x slower than std::io::BufReader::read_to_end(). My rustc version is rustc 1.69.0-nightly (75a0be98f 2023-02-05). My OS is Debian Stretch x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-processArea: `std::process` and `std::env`C-bugCategory: This is a bug.I-slowIssue: Problems and improvements with respect to performance of generated code.O-unixOperating system: Unix-like

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions