-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(sequencing): replace BTreeMap with HashMap in StreamHandler #2517
Conversation
78dd7ea
to
bb57c46
Compare
29a7123
to
60d4672
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2517 +/- ##
===========================================
- Coverage 40.10% 13.22% -26.89%
===========================================
Files 26 63 +37
Lines 1895 7744 +5849
Branches 1895 7744 +5849
===========================================
+ Hits 760 1024 +264
- Misses 1100 6683 +5583
- Partials 35 37 +2 ☔ View full report in Codecov by Sentry. |
bb57c46
to
8682fd1
Compare
60d4672
to
31afe42
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @guy-starkware and @matan-starkware)
crates/sequencing/papyrus_consensus/src/stream_handler_test.rs
line 38 at r1 (raw file):
// Check if two vectors are the same, regardless of ordering fn do_vecs_match_unordered<T: PartialEq>(a: &[T], b: &[T]) -> bool
it also ignores duplicates, is this what u want?
8682fd1
to
7bc63e0
Compare
ea76fac
to
379fbbb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on @asmaastarkware and @matan-starkware)
crates/sequencing/papyrus_consensus/src/stream_handler_test.rs
line 38 at r1 (raw file):
Previously, asmaastarkware (asmaa-starkware) wrote…
it also ignores duplicates, is this what u want?
You are right. This probably doesn't matter in these test cases, but I will use a different comparison (I'm just going to order the vectors before checking the values.
7bc63e0
to
f2ad96b
Compare
379fbbb
to
0c88ba4
Compare
f2ad96b
to
a5d57e5
Compare
0c88ba4
to
3e48a5f
Compare
a5d57e5
to
2f802e2
Compare
3e48a5f
to
c9b269b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @guy-starkware and @matan-starkware)
crates/sequencing/papyrus_consensus/src/stream_handler_test.rs
line 47 at r2 (raw file):
b.sort(); let matching = a.iter().zip(b.iter()).filter(|&(a, b)| a == b).count(); matching == a.len() && matching == b.len()
Check lengths first to avoid unnecessary sorting
Suggestion:
if a.len() != b.len() {
return false;
}
let mut a = a.clone();
a.sort();
let mut b = b.clone();
b.sort();
a == b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @asmaastarkware and @matan-starkware)
crates/sequencing/papyrus_consensus/src/stream_handler_test.rs
line 47 at r2 (raw file):
Previously, asmaastarkware (asmaa-starkware) wrote…
Check lengths first to avoid unnecessary sorting
For some reason I didn't know that a==b
works. I think we can get rid of the length check altogether. As this is a test (on few elements) I don't see a reason to optimize it by checking lengths at all...
Thanks!
c9b269b
to
92b40d1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @matan-starkware)
2f802e2
to
307e662
Compare
92b40d1
to
389e22b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r1, 1 of 1 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @guy-starkware)
Merge activity
|
389e22b
to
e759892
Compare
I've wanted to remove the BTreeMap from StreamHandler for a while.
It functions the same as HashMap but has the ordered keys feature, which we no longer use.
It seems simpler to just work with one kind of map.