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

Add a benchmark command #1733

Closed
sophiajt opened this issue May 8, 2020 · 6 comments
Closed

Add a benchmark command #1733

sophiajt opened this issue May 8, 2020 · 6 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@sophiajt
Copy link
Member

sophiajt commented May 8, 2020

Is your feature request related to a problem? Please describe.
It's sometimes helpful to want to measure how long a block takes to execute. It'd be nice to be able to measure this inside of Nu.

Describe the solution you'd like

Let's add a benchmark command that takes a block as input. When run, benchmark will start timing, run the block to completion, and then report the time it took to run the block.

The benchmark command can return the time as a Duration value.

Additional context
You can read the with-env command source code at "crates/nu-cli/src/commands/with_env.rs" to learn how to run a block to completion.

@sophiajt sophiajt added the good first issue Good for newcomers label May 8, 2020
@thegedge thegedge added the enhancement New feature or request label May 8, 2020
@pag4k
Copy link
Contributor

pag4k commented May 8, 2020

I would like to work on this.

@sophiajt
Copy link
Member Author

sophiajt commented May 8, 2020

@pag4k great - I've assigned it to you

@quebin31
Copy link
Contributor

quebin31 commented Jun 8, 2020

Shouldn't be clearer and shorter to be bench instead of benchmark?

@thegedge
Copy link
Contributor

thegedge commented Jun 8, 2020

Shouldn't be clearer and shorter to be bench instead of benchmark?

I think bench is less clear when considering an ESL (english as a second language) perspective, so I'd rather stick to full words and people can always alias to shorter names, if they so desire 🙂

Another option is time, which is pretty common in shells (and there's a /usr/bin/time on a lot of UNIX-y platforms).

@quebin31
Copy link
Contributor

quebin31 commented Jun 8, 2020

Shouldn't be clearer and shorter to be bench instead of benchmark?

I think bench is less clear when considering an ESL (english as a second language) perspective, so I'd rather stick to full words and people can always alias to shorter names, if they so desire slightly_smiling_face

Another option is time, which is pretty common in shells (and there's a /usr/bin/time on a lot of UNIX-y platforms).

Yea, I guess time would be even better, but it's clearly open to consensus.

@JosephTLyons
Copy link
Contributor

Closed by #2223

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants