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

Pathological performance with lots of arguments #207

Open
alexcrichton opened this issue Jan 17, 2017 · 0 comments
Open

Pathological performance with lots of arguments #207

alexcrichton opened this issue Jan 17, 2017 · 0 comments

Comments

@alexcrichton
Copy link
Contributor

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant