Coder Social home page Coder Social logo

Add short flags for `--export` about hyperfine HOT 2 OPEN

Neved4 avatar Neved4 commented on June 1, 2024 2
Add short flags for `--export`

from hyperfine.

Comments (2)

sharkdp avatar sharkdp commented on June 1, 2024 2

Thank you for writing this down. I like the idea!

How would we export to multiple formats? I sometimes export to markdown and json at the same time, for example.

from hyperfine.

Neved4 avatar Neved4 commented on June 1, 2024 2

Thanks for the feedback! You've raised an excellent point.

Let's say we're targeting all export formats. Currently, we do that with:

hyperfine \
    --export-asciidoc FILE.asciidoc \
    --export-csv FILE.csv           \
    --export-json FILE.json         \
    --export-markdown FILE.md       \
    --export-markdown FILE.org

With an auto-detection feature in place, we could rely on default file extensions and implicit file format inference:

hyperfine -f FILE.asciidoc -f FILE.csv -f FILE.json -f FILE.md -f FILE.org

We can also reduce verbosity by adding the ability to group formats:

hyperfine -f FILE.asciidoc,FILE.csv,FILE.json,FILE.md,FILE.org

Another option is to reuse the existing idea of the parameter list -L, and introduce an -E flag for exporting formats. For example:

hyperfine -E asciidoc,csv,json,md,org '-f FILE.{ext}'

Consider a different scenario, where we want to export all formats file extensions arbitrarily. Right now:

hyperfine \
    --export-asciidoc result.org  \
    --export-csv result.asciidoc  \
    --export-json result.csv      \
    --export-markdown result.json \
    --export-orgmode result.md

With a -E flag we have the option to combine with an hypothetical -F:

hyperfine \
    -F fmt asciidoc,csv,json,markdown,orgmode \
    -E ext org,asciidoc,csv,json,md \
    '-f {fmt} result.{ext}'
Note that in flags -E and -F, quoted blocks will be interpreted exclusively for exporting, not adding extra commands to be benchmarked.

In the long run, this level of parametrization may not be high priority, as it appears to cater more to rare use cases.

from hyperfine.

Related Issues (20)

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.