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 black_box to benchmarks #27

Closed
wants to merge 0 commits into from

Conversation

sunsided
Copy link
Contributor

@sunsided sunsided commented May 26, 2024

This ensures the benchmarks do not accidentally optimize for the provided constants.

On my machine, this would change the reported benchmark results from

running 3 tests
test bench_all_price          ... bench:           2.44 ns/iter (+/- 0.79)
test bench_all_price_no_cache ... bench:          73.79 ns/iter (+/- 11.15)
test bench_call_price         ... bench:          43.34 ns/iter (+/- 14.57)

to

running 3 tests
test bench_all_price          ... bench:          61.22 ns/iter (+/- 30.21)
test bench_all_price_no_cache ... bench:         250.83 ns/iter (+/- 84.97)
test bench_call_price         ... bench:          40.98 ns/iter (+/- 21.33)

This should give a more accurate picture.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 9243228171

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.4%) to 80.163%

Files with Coverage Reduction New Missed Lines %
src/lib.rs 1 80.16%
Totals Coverage Status
Change from base Build 4354937295: -0.4%
Covered Lines: 406
Relevant Lines: 445

💛 - Coveralls

@sunsided
Copy link
Contributor Author

The benchmark test now obviously fails because the report baseline has changed.

@danielhstahl
Copy link
Owner

Didn't this get merged already? I'm surprised its not showing a merge conflict...

@sunsided sunsided closed this May 26, 2024
@sunsided sunsided force-pushed the feature/black-box branch from 7844b67 to 3cf7ecf Compare May 26, 2024 13:23
@sunsided
Copy link
Contributor Author

@danielhstahl Must have been a glitch. I rebased it against master and now it's correctly an empty PR due to #28.

@sunsided sunsided deleted the feature/black-box branch May 26, 2024 13:30
@danielhstahl
Copy link
Owner

Thanks @sunsided . Your changes have been deployed in 10.2: https://crates.io/crates/black_scholes

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.

3 participants