Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow several --parameter-list flags to set #273

Closed
ghost opened this issue Mar 12, 2020 · 3 comments
Closed

Allow several --parameter-list flags to set #273

ghost opened this issue Mar 12, 2020 · 3 comments

Comments

@ghost
Copy link

ghost commented Mar 12, 2020

Description

Right now, we can use --parameter-list and that's great. I like the idea of parametrised benchmarks. Though, sometimes, you need to specify several parameter lists with different values.

Expected Behaviour

When calling hyperfine:

hyperfine \
  --parameter-list npm_flags --some,--flags,--here \
  --parameter-list yarn_flags --some,--other,--flags \
  "npm install {npm_flags}" \
  "yarn install {yarn_flags}"

I expect to have a possibility to parametrise different clients, that expect different flags. Surely, I can do it manually by duplicating commands for each flag, but why when you have such great flag.

Current Behaviour

When calling the command like above, I'm getting:

error: The following required arguments were not provided:
    <command>...

USAGE:
    hyperfine <command>... --parameter-list <VAR> <VALUES> --prepare <CMD>...

For more information try --help

Notes

I had a look into your code and seems like you does not support --parameter-list flag as collection, but as single possible value.

Is there any way to implement such kind of behaviour?

@sharkdp
Copy link
Owner

sharkdp commented Mar 15, 2020

Thank you for the feedback.

If we would implement this, it would interfere with what is requested in #253. For me, it seems like #253 is the more common use case, as compared to this one. I think this ticket would actually be solved by the "zipped" version discussed in #253?

@ghost
Copy link
Author

ghost commented Mar 16, 2020

#253 is what I want to have, actually, it does not interfere 😄

I see that you still not sure about syntax and flags for it, but semantically that's exactly I want to achieve - a way to create different variables and assign to them different values, so I could expand it while benchmarking.

For now, I made a workaround as an array of commands to run in Bash script:

SCRIPTS=(
    "${NPM_INSTALL} && ${NPM_BUILD}"
    "${NPM_INSTALL} --prefer-offline && ${NPM_BUILD}"
    "${NPM_INSTALL} --prefer-online && ${NPM_BUILD}"
    "${YARN_INSTALL} && ${YARN_BUILD}"
    "${PNPM_INSTALL} && ${PNPM_BUILD}"
    "${PNPM_INSTALL} --prefer-offline && ${PNPM_BUILD}"
)

hyperfine \
    --prepare "${CLEAN_ARTIFACTS} && ${CLEAN_CACHE}" \
    --export-json cold_cache_without_node_modules.json \
    "${SCRIPTS[@]}"

@sharkdp
Copy link
Owner

sharkdp commented May 24, 2020

closing this in favor of #253

@sharkdp sharkdp closed this as completed May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant