diff --git a/opening-book/pc-gen/Cargo.toml b/opening-book/pc-gen/Cargo.toml index 1b21227..a1fea57 100644 --- a/opening-book/pc-gen/Cargo.toml +++ b/opening-book/pc-gen/Cargo.toml @@ -13,3 +13,4 @@ enumset = "0.4.0" pcf = { git = "https://github.com/MinusKelvin/pcf" } arrayvec = "0.5.1" rayon = "1.4.1" +crossbeam-channel = "0.5.0" diff --git a/opening-book/pc-gen/src/main.rs b/opening-book/pc-gen/src/main.rs index 09d1a84..f578647 100644 --- a/opening-book/pc-gen/src/main.rs +++ b/opening-book/pc-gen/src/main.rs @@ -10,7 +10,7 @@ fn main() { .chain(pcf::PIECES.iter()) .chain(pcf::PIECES.iter()) .copied().collect(); - let (send, recv) = std::sync::mpsc::channel::>(); + let (send, recv) = crossbeam_channel::unbounded::>(); let t = std::time::Instant::now(); pcf::find_combinations_mt( first_pc_bag, pcf::BitBoard(0), &AtomicBool::new(false), 4, @@ -26,7 +26,7 @@ fn main() { let mut book = BookBuilder::new(); rayon::scope(|s| { - let (send, recv) = std::sync::mpsc::sync_channel(1 << 16); + let (send, recv) = crossbeam_channel::bounded(256); let mut queued_bags = HashSet::new(); let mut bags = vec![EnumSet::empty()]; @@ -35,7 +35,7 @@ fn main() { while let Some(initial_bag) = bags.pop() { for (seq, bag) in all_sequences(initial_bag) { if queued_bags.insert(bag) { - // bags.push(bag); + bags.push(bag); } let send = send.clone(); let combos = all_combinations.get(