performance optimization in 54

This commit is contained in:
Dr. Matthias Ratajczak
2022-08-18 18:11:12 +02:00
parent 06f722ba7f
commit dd8ea500ae
3 changed files with 3 additions and 7 deletions
-1
View File
@@ -11,7 +11,6 @@ num = "*"
[dev-dependencies]
criterion = "*"
[[bench]]
name = "benchmark"
harness = false
+2 -2
View File
@@ -11,8 +11,6 @@ path = "src/lib.rs"
name = "euler54"
path = "src/main.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rstest = "*"
@@ -21,6 +19,8 @@ criterion = "*"
[profile.release]
debug = true
lto = true
codegen-units = 1
[[bench]]
name = "benchmark"
+1 -4
View File
@@ -51,10 +51,7 @@ impl Cards {
}
pub fn have_matching_suits(&self) -> bool {
self.array[1..]
.iter()
.zip(self.array[..4].iter())
.all(|(c1, c2)| c1.suit == c2.suit)
self.suit_hashset.len() == 1
}
pub fn contain_all_values_of(&self, values: &Values) -> bool {