Skip to content
This repository was archived by the owner on Sep 14, 2023. It is now read-only.
This repository was archived by the owner on Sep 14, 2023. It is now read-only.

Pathological performance with lots of arguments #207

Open
@alexcrichton

Description

@alexcrichton

Reduced down from rust-lang/cargo#3547 (comment), the following program takes quite a long time to complete under --release

extern crate rustc_serialize;
extern crate docopt;

use docopt::Docopt;

// Write the Docopt usage string.
const USAGE: &'static str = "
Usage: cargo run [options] [--] [<args>...]

Options:
    -a, --archive  Copy everything.
";

#[derive(Debug, RustcDecodable)]
struct Args {
    arg_args: Vec<String>,
    flag_archive: bool,
}

fn main() {
    let mut args = vec![
        "cargo".to_string(),
        "run".to_string(),
        "--".to_string(),
    ];
    args.extend((0..20_000).map(|i| i.to_string()));

    let dopt = Docopt::new(USAGE).unwrap().argv(args);
    println!("starting");
    let parsed = dopt.parse().unwrap();
}

I'm curious, is this a "wontfix" in docopt or perhaps something that'd be relatively easily optimizable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions