I love performance
This commit is contained in:
parent
9367dc0caf
commit
338888133c
2 changed files with 8 additions and 9 deletions
|
|
@ -34,7 +34,9 @@ impl Adjacencies {
|
|||
|
||||
pub fn reset(&mut self) {
|
||||
self.amap.iter_mut().for_each(|bitvec| {
|
||||
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()
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue