Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2258 +/- ##
==========================================
+ Coverage 77.56% 77.59% +0.03%
==========================================
Files 147 147
Lines 15789 15798 +9
==========================================
+ Hits 12247 12259 +12
+ Misses 3542 3539 -3
🚀 New features to boost your workflow:
|
|
@wjmelements you should ping @LesnyRumcajs if you want some native Rust eyes. My concerns with this are:
|
| range.size() | ||
| - (self.unset.range(range.clone()).count() as u64) | ||
| - (self.set.range(range.clone()).count() as u64) |
There was a problem hiding this comment.
Not sure about the correctness of the implementation per se, probably some more (fuzz?) tests would do.
In this particular case, I see a potential danger of integer underflow, i.e., if range.size() < ((self.unset.range(range.clone()).count() as u64) + (self.set.range(range.clone()).count() as u64)) then some absurd values could get produced. Given we have overflow-checks = true for wasm profile, it'd probably panic (bad). Can we guarantee the condition above doesn't happen? Is it already guaranteed from some internal logic? If so, some comment to reassure the reader would help.
Reviewers @Kubuxu @Stebalien
Context
I am familiarizing myself with this codebase and the rust language.
Concept
By avoiding the expensive
ranges()step, the performance oflencan be greatly improved.cargo bench
Changes