Skip to content

expr: Get rid of clap #7337

@RenjiSann

Description

@RenjiSann

While testing expr for performance, I noticed a 10x factor between our implementation and GNU's implementation when giving the command a large list of arguments (1 + 1 + 1 ... 10000 times).

The profiling indicates that the bottleneck is caused by clap which takes forever to parse all the arguments.

This is actually not needed, because expr can only be used in 3 possible ways :

  • expr --version
  • expr --help
  • expr [TOKENS ...]

This is simple enough so we shouldn't need clap to do it for us.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions