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

feat(bench): add BenchContext::start() and BenchContext::end() #18734

Merged
merged 9 commits into from
Jul 31, 2023

Conversation

nayeemrmn
Copy link
Collaborator

Closes #17589.

Deno.bench("foo", async (t) => {
  const resource = setup(); // not included in measurement
  t.start();
  measuredOperation(resource);
  t.end();
  resource.close(); // not included in measurement
});

@bartlomieju
Copy link
Member

@nayeemrmn please rebase, let's land it for v1.36

@bartlomieju bartlomieju added this to the 1.36 milestone Jul 5, 2023
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, cool feature, thank you @nayeemrmn

@bartlomieju bartlomieju merged commit 02865cb into denoland:main Jul 31, 2023
10 checks passed
@nayeemrmn nayeemrmn deleted the bench-explicit-start-end branch August 19, 2023 17:28
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

Successfully merging this pull request may close these issues.

Deno.bench does not allow specifying setup/teardown functions for each execution
2 participants