Enable lto in benchmarks

This commit is contained in:
kageru 2021-12-03 20:27:57 +01:00
parent 70450dbcdc
commit 964a84df45
Signed by: kageru
GPG Key ID: 8282A2BEA4ADA3D2
2 changed files with 4 additions and 0 deletions

View File

@ -6,3 +6,6 @@ edition = "2021"
[dependencies]
itertools = "0.10"
paste = "1.0"
[profile.bench]
lto = true

View File

@ -39,6 +39,7 @@ fn part2(parsed: &Parsed, bits: usize) -> usize {
let gamma = most_common_at(&matching_gamma, i);
let epsilon = !most_common_at(&matching_epsilon, i);
// TODO: Find out why retain is significantly slower than filter().collect()
// Update: Let’s see what the maintainers say: https://github.com/rust-lang/rust/issues/91497
// matching_gamma.retain(|&n| bit_at(n, i) == gamma);
matching_gamma = matching_gamma.into_iter().filter(|&n| bit_at(n, i) == gamma).collect();
if matching_epsilon.len() > 1 {