Coder Social home page Coder Social logo

Command-line argument processing about stella2 HOT 3 CLOSED

yvt avatar yvt commented on July 24, 2024
Command-line argument processing

from stella2.

Comments (3)

yvt avatar yvt commented on July 24, 2024

https://www.reddit.com/r/rust/comments/exbbes/argh_is_googles_opinionated_derivebased_argument/

from stella2.

yvt avatar yvt commented on July 24, 2024

Base version: 3aebf68

#[derive(argh::FromArgs)]
/// A lightweight instant messaging client.
struct Args {
    /// the path to a custom profile directory
    #[argh(option)]
    profile: Option<String>,
}

let measure_start = unsafe { std::arch::x86_64::_rdtsc() };
let _: Args = argh::from_env();
let measure_end = unsafe { std::arch::x86_64::_rdtsc() };
dbg!(measure_end - measure_start);
Library CPU cycles¹ .text size
None 0 462848
argh 20569 475136 (+12KiB)
gumdrop 23549 475136 (+12KiB)
clap (minimum) 283296 860160 (+388KiB)
pico-args² 26356 475136 (+12KiB)

¹ The minimum value of circa 10 samples. To simulate the common usage, no command-line arguments were provided.

² pico-args does not support help generation. The application handles -h manually and prints a pre-formatted help message.

Screen Shot 2020-02-16 at 23 41 38

from stella2.

yvt avatar yvt commented on July 24, 2024

Implemented a custom command-line parsing solution in ed5e0d8.

Library CPU cycles¹ .text size
None 0 462848
Custom Solution 20977 471040 (+8KiB)

from stella2.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.