Skip to content

Commit

Permalink
use crossbeam-channel instead of std channels
Browse files Browse the repository at this point in the history
  • Loading branch information
MinusKelvin committed Oct 12, 2020
1 parent 69b7711 commit 6ad70da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions opening-book/pc-gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 3 additions & 3 deletions opening-book/pc-gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn main() {
.chain(pcf::PIECES.iter())
.chain(pcf::PIECES.iter())
.copied().collect();
let (send, recv) = std::sync::mpsc::channel::<ArrayVec<[_; 10]>>();
let (send, recv) = crossbeam_channel::unbounded::<ArrayVec<[_; 10]>>();
let t = std::time::Instant::now();
pcf::find_combinations_mt(
first_pc_bag, pcf::BitBoard(0), &AtomicBool::new(false), 4,
Expand All @@ -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()];
Expand All @@ -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(
Expand Down

0 comments on commit 6ad70da

Please sign in to comment.