chore: ci: run `cargo check` and clippy for all targets
Here targets refer to cargo targets: binaries, tests, benches etc.
Bencher Report
| Branch | ivan/check-all-targets |
| Testbed | ubuntu-latest |
Click to view all benchmark results
Bencher Report
| Branch | ivan/check-all-targets |
| Testbed | ubuntu-latest |
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| decrypt1000MessagesWeb | 📈 view plot 🚷 view threshold | 426.50 ms |
I don't think that eliminating
black_boxcalls from the benches is the right strategy. It feels like exactly the kind of hinting you want for a good benchmark. https://doc.rust-lang.org/beta/std/hint/fn.black_box.html
For this particular case, I do not think that calls to black_box were done in any systematic or meaningful way.
(If someone knows more about the way it was done, I'd be happy to know!)
For instance, what should
black_box(());
actually do?
Not only that, but a thing like
black_box(foo(....)));
where foo() returns a unit value seems unnecessary, especially when you consider the fact that arguments are evaluated eagerly. Honestly, without a proper reasoning why this actually helps, this feels more like cargo culting.
Sure, passing a literal unit struct is probably pointless. I don't mind stripping those instances.
black_box(foo(....)));
This does feel helpful, to me. The documentation linked above has a whole section called When is this useful?. It's a compiler hint aimed at avoiding the compiler deciding "foo has no effects observable from the outside, so no point calling it here at all.
this feels more like cargo culting.
I mean, that's kind of fair. I have not attempted to understand the actual set of optimizations that LLVM applies to an arbitrary piece of Rust code, and can't prove that the black box is helpful in this case.
On the other hand, what we have here is a compiler hint intended for benchmarking, being used in the documented way in some benchmarks. We can only really prove it's useful if by removing it our benchmarks suddenly get much faster, because they're no longer measuring anything. But that might only happen at some point in the future when the compiler optimizer changes without our notice. Seems safer to leave it in place.
I mean, that's kind of fair. I have not attempted to understand the actual set of optimizations that LLVM applies to an arbitrary piece of Rust code, and can't prove that the black box is helpful in this case.
On the other hand, what we have here is a compiler hint intended for benchmarking, being used in the documented way in some benchmarks. We can only really prove it's useful if by removing it our benchmarks suddenly get much faster, because they're no longer measuring anything. But that might only happen at some point in the future when the compiler optimizer changes without our notice. Seems safer to leave it in place.
Fair. I've added allow attributes in cases where a non-literal unit is passed, and removed the rest.