Skip to content

Commit

Permalink
Merge a62508b into sapling-pr-archive-shadaj
Browse files Browse the repository at this point in the history
  • Loading branch information
shadaj authored Sep 9, 2023
2 parents face919 + a62508b commit 6c63026
Show file tree
Hide file tree
Showing 299 changed files with 9,844 additions and 1,803 deletions.
58 changes: 50 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ members = [
"hydroflow_datalog_core",
"hydroflow_lang",
"hydroflow_macro",
"hydroflow_plus",
"hydroflow_plus_macro",
"hydroflow_plus_example_flow",
"hydroflow_plus_example_runtime",
"lattices",
"multiplatform_test",
"pusherator",
Expand Down
12 changes: 6 additions & 6 deletions benches/benches/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ where
}
}

left_tab.entry(k).or_insert_with(Vec::new).push(v);
left_tab.entry(k).or_default().push(v);
}
});

Expand All @@ -76,7 +76,7 @@ where
}
}

right_tab.entry(k).or_insert_with(Vec::new).push(v);
right_tab.entry(k).or_default().push(v);
}
});
}
Expand All @@ -98,24 +98,24 @@ where
b.iter(|| {
let iter_a = (0..NUM_INTS).map(|x| (x, L::new(x)));
let iter_b = (0..NUM_INTS).map(|x| (x, R::new(x)));
let mut items_a = HashMap::new();
let mut items_b = HashMap::new();
let mut items_a = HashMap::<_, Vec<_>>::new();
let mut items_b = HashMap::<_, Vec<_>>::new();

for (key, val_a) in iter_a {
if let Some(vals_b) = items_b.get(&key) {
for val_b in vals_b {
black_box((key, val_a.clone(), val_b));
}
}
items_a.entry(key).or_insert_with(Vec::new).push(val_a);
items_a.entry(key).or_default().push(val_a);
}
for (key, val_b) in iter_b {
if let Some(vals_a) = items_a.get(&key) {
for val_a in vals_a {
black_box((key, val_a, val_b.clone()));
}
}
items_b.entry(key).or_insert_with(Vec::new).push(val_b);
items_b.entry(key).or_default().push(val_b);
}
});
},
Expand Down
4 changes: 2 additions & 2 deletions benches/benches/reachability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ lazy_static::lazy_static! {
let cursor = Cursor::new(include_bytes!("reachability_edges.txt"));
let reader = BufReader::new(cursor);

let mut edges = HashMap::new();
let mut edges = HashMap::<_, Vec<_>>::new();
for line in reader.lines() {
let line = line.unwrap();
let mut nums = line.split_whitespace();
let a = nums.next().unwrap().parse().unwrap();
let b = nums.next().unwrap().parse().unwrap();
assert!(nums.next().is_none());
edges.entry(a).or_insert_with(Vec::new).push(b);
edges.entry(a).or_default().push(b);
}
edges
};
Expand Down
48 changes: 31 additions & 17 deletions benches/benches/symmetric_hash_join.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::hint::black_box;

use criterion::{criterion_group, criterion_main, Criterion};
use hydroflow::compiled::pull::{SetJoinState, SymmetricHashJoin};
use hydroflow::compiled::pull::{symmetric_hash_join_into_iter, HalfSetJoinState};
use rand::distributions::Distribution;
use rand::rngs::StdRng;
use rand::SeedableRng;
Expand All @@ -14,11 +14,14 @@ fn ops(c: &mut Criterion) {
let rhs: Vec<_> = (0..3000).map(|v| (v + 50000, ())).collect();

b.iter(|| {
let mut state = black_box(SetJoinState::default());
let join = SymmetricHashJoin::new(
let (mut lhs_state, mut rhs_state) =
black_box((HalfSetJoinState::default(), HalfSetJoinState::default()));
let join = symmetric_hash_join_into_iter(
black_box(lhs.iter().cloned()),
black_box(rhs.iter().cloned()),
&mut state,
&mut lhs_state,
&mut rhs_state,
false,
);

for v in join {
Expand All @@ -32,11 +35,14 @@ fn ops(c: &mut Criterion) {
let rhs: Vec<_> = (0..3000).map(|v| (v, v + 50000)).collect();

b.iter(|| {
let mut state = black_box(SetJoinState::default());
let join = SymmetricHashJoin::new(
let (mut lhs_state, mut rhs_state) =
black_box((HalfSetJoinState::default(), HalfSetJoinState::default()));
let join = symmetric_hash_join_into_iter(
black_box(lhs.iter().cloned()),
black_box(rhs.iter().cloned()),
&mut state,
&mut lhs_state,
&mut rhs_state,
false,
);

for v in join {
Expand All @@ -50,13 +56,15 @@ fn ops(c: &mut Criterion) {
let rhs: Vec<_> = (0..3000).map(|v| (v, v)).collect();

b.iter(|| {
let mut state = black_box(SetJoinState::default());
let join = SymmetricHashJoin::new(
let (mut lhs_state, mut rhs_state) =
black_box((HalfSetJoinState::default(), HalfSetJoinState::default()));
let join = symmetric_hash_join_into_iter(
black_box(lhs.iter().cloned()),
black_box(rhs.iter().cloned()),
&mut state,
&mut lhs_state,
&mut rhs_state,
false,
);

for v in join {
black_box(v);
}
Expand All @@ -77,11 +85,14 @@ fn ops(c: &mut Criterion) {
.collect();

b.iter(|| {
let mut state = black_box(SetJoinState::default());
let join = SymmetricHashJoin::new(
let (mut lhs_state, mut rhs_state) =
black_box((HalfSetJoinState::default(), HalfSetJoinState::default()));
let join = symmetric_hash_join_into_iter(
black_box(lhs.iter().cloned()),
black_box(rhs.iter().cloned()),
&mut state,
&mut lhs_state,
&mut rhs_state,
false,
);

for v in join {
Expand All @@ -105,11 +116,14 @@ fn ops(c: &mut Criterion) {
.collect();

b.iter(|| {
let mut state = black_box(SetJoinState::default());
let join = SymmetricHashJoin::new(
let (mut lhs_state, mut rhs_state) =
black_box((HalfSetJoinState::default(), HalfSetJoinState::default()));
let join = symmetric_hash_join_into_iter(
black_box(lhs.iter().cloned()),
black_box(rhs.iter().cloned()),
&mut state,
&mut lhs_state,
&mut rhs_state,
false,
);

for v in join {
Expand Down
Loading

0 comments on commit 6c63026

Please sign in to comment.