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

Parameterised benchmarks #67

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

bens
Copy link
Collaborator

@bens bens commented Mar 17, 2024

This implementation is pretty simple and allows any number and type of parameters to be used, I think the API is pretty pleasant too. Despite the @ptrCasts and anyopaques I'm pretty confident it's type safe as long as benchmarks are always added using the API functions.

close #55

@bens bens force-pushed the parameters branch 3 times, most recently from 5da8da5 to 019dccb Compare March 17, 2024 14:02
@bens bens marked this pull request as draft March 17, 2024 14:02
@bens bens force-pushed the parameters branch 3 times, most recently from 960c5d8 to bb63c43 Compare March 17, 2024 22:09
@bens bens marked this pull request as ready for review March 17, 2024 22:11
@bens bens requested a review from hendriknielaender March 17, 2024 22:11
@bens
Copy link
Collaborator Author

bens commented Mar 17, 2024

Hoping to address #55. @adworacz, would something like this work for your needs? This should allow any parameters you could want to vary a benchmark.

It would be nice to automatically format the parameters to strings similar to what hyperfine does, but it would be less straightforward than this. Hyperfine is always given strings so that makes it pretty trivial, while parameters could be anything at all in this implementation.

zbench.zig Outdated Show resolved Hide resolved
@bens bens added the enhancement New feature or request label Mar 18, 2024
@bens bens self-assigned this Mar 18, 2024
@adworacz
Copy link

Hmmm this is quite interesting, and is a different approach than I expected, but it certainly seems like it would work for my use case. The use of a wrapping struct for this seems actually quite powerful, in ways that I hadn't initially expected.

Looks good to me, and thank you!

@hendriknielaender hendriknielaender merged commit c0d82a0 into hendriknielaender:main Mar 19, 2024
5 checks passed
@bens bens deleted the parameters branch March 19, 2024 06:38
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

Successfully merging this pull request may close these issues.

Support passing parameters to benchmark functions
3 participants