I love performance

This commit is contained in:
Noa Aarts 2025-12-10 23:50:08 +01:00
parent 9367dc0caf
commit 338888133c
Signed by: noa
GPG key ID: 1850932741EFF672
2 changed files with 8 additions and 9 deletions

View file

@ -34,7 +34,9 @@ impl Adjacencies {
pub fn reset(&mut self) {
self.amap.iter_mut().for_each(|bitvec| {
bitvec.clear();
if bitvec.any() {
bitvec.clear();
}
})
}
@ -45,7 +47,7 @@ impl Adjacencies {
})
}
fn intersect(&self, other: &Adjacencies) -> Adjacencies {
pub fn intersect(&self, other: &Adjacencies) -> Adjacencies {
Adjacencies {
amap: self
.amap
@ -154,10 +156,6 @@ impl Seating {
}
}
fn make_clone(&self) -> Self {
self.clone()
}
fn empty_table_coords(&self) -> Vec<(usize, Side)> {
self.people_top
.iter()

View file

@ -7,16 +7,17 @@ use std::{
use shuffles::*;
fn main() {
for size in 0..17 {
for size in 0..18 {
let table = Seating::make_seating(size);
println!("We have a table\n{table}");
let mut corot = table.calc_alternatives(size);
println!("searching size {size}");
let mut total = 0;
loop {
match Pin::new(&mut corot).resume(()) {
CoroutineState::Yielded(val) => println!("found setting\n{val}"),
CoroutineState::Yielded(_val) => total += 1,
CoroutineState::Complete(total_checked) => {
println!("checked {total_checked} in total");
println!("checked {total_checked} in total to find {total} valid alternatives");
break;
}
}