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

Revise benchmark setup api #52

Closed
hendriknielaender opened this issue Feb 21, 2024 · 1 comment
Closed

Revise benchmark setup api #52

hendriknielaender opened this issue Feb 21, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@hendriknielaender
Copy link
Owner

Issue Description

The current process for setting up and executing benchmarks may present confusion for new users. It's unclear why initialization of results and the benchmark needs to be done separately, and similarly, the rationale behind de-initializing results but not the benchmark or allocator is not evident.

This complexity could hinder new user engagement and overall usability of the benchmarking tool. Streamlining the API would significantly improve the user experience, making it more intuitive and straightforward.

Suggested Improvement

A revision to the API is proposed to encapsulate the benchmark setup and execution in a more user-friendly and intuitive manner. The following code snippet illustrates the proposed streamlined approach:

var bench = Benchmark.init(std.heap.page_allocator, .{
    .iterations = 10,
});
defer bench.deinit();
try bench.add("basic example", basicfn);
try bench.add("sleep example", sleepfn);
try bench.run();

This suggested approach aims to enhance the benchmarking process by:

  • Simplifying the de-initialization process for ease of use.
  • Facilitating the addition and execution of benchmarks in a more intuitive manner.
@hendriknielaender
Copy link
Owner Author

#61

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

No branches or pull requests

1 participant