Skip to content

Update utils so the benchmark is not optimized out #21

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hpcdisrespecter
Copy link

Otherwise, warning is emitted by test harness:

 benchmark was likely optimized out (dead code elimination) = !
 https://github.com/evanwashere/mitata#writing-good-benchmarks

@tpetry
Copy link

tpetry commented Apr 24, 2025

The mitata docs show that a value should be passed into the do_not_optimize function. Not a closure. Are you sure that closure is really executed by mitata?

@hpcdisrespecter
Copy link
Author

I'm not sure.
What I am sure of is that, by default, when running small tests, that bun doesn't actually run the code. It reports sub-100ps speeds, which mitata flags as erroneous, probably because bun is optimizing this out, so the benchmark is incorrect.

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.

2 participants