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

Consider using Bencher::bench_refs #1

Closed
nvzqz opened this issue Feb 16, 2024 · 6 comments
Closed

Consider using Bencher::bench_refs #1

nvzqz opened this issue Feb 16, 2024 · 6 comments

Comments

@nvzqz
Copy link

nvzqz commented Feb 16, 2024

Thanks for the cool benchmark! Glad to see how folks are using Divan.

I think it might be an improvement to use Bencher::bench_refs instead of Bencher::bench_values because it would:

  • Remove the time to deallocate the inputs from benchmarks
  • Balance dealloc info with alloc info
astral4 added a commit that referenced this issue Feb 16, 2024
… benchmark accuracy

As mentioned in #1, this change removes time spent deallocating inputs from the benchmark measurements. This should lead to more accurate time and memory statistics.
@astral4
Copy link
Owner

astral4 commented Feb 16, 2024

Good point! I've updated the benchmark code and results.

Also, thanks for your work on Divan—it's a great library and I look forward to using it in future projects.

@astral4 astral4 closed this as completed Feb 16, 2024
@nvzqz
Copy link
Author

nvzqz commented Feb 16, 2024

Thanks for the kind words!

Also, you don't need to black_box inputs passed via bench_refs. 🙂

@smu160
Copy link

smu160 commented Feb 18, 2024

@nvzqz

Divan is a great library! Thank you for giving me the pre-release demo at RustConf!

Two questions for you:

What is the diffence between bench_local_refs and bench_refs?

Is there a way to get the output in a format that would make it simply to plot results with matplotlib?

@nvzqz
Copy link
Author

nvzqz commented Feb 19, 2024

  1. bench_local_refs does not have a Sync requirement. This allows for mutating local variables at the cost of not being able to benchmark across multiple threads. Thanks for asking since I didn't realize I hadn't documented any distinction between them.
  2. Not yet. I recommend subscribing to Output format to JSON nvzqz/divan#10 for updates on this.

@smu160
Copy link

smu160 commented Feb 21, 2024

@nvzqz Thank you for the prompt reply! Does it matter whether I use bench_local_refsor bench_refs if the function being benchmarked is single-threaded?

@nvzqz
Copy link
Author

nvzqz commented Feb 21, 2024

They behave the same in single-threaded benchmarks. I would stick to bench_refs unless you need bench_local_refs.

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

No branches or pull requests

3 participants