-
Notifications
You must be signed in to change notification settings - Fork 84
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
Refactor Empirical distribution #308
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #308 +/- ##
==========================================
+ Coverage 93.70% 93.80% +0.10%
==========================================
Files 53 53
Lines 11939 12002 +63
==========================================
+ Hits 11187 11259 +72
+ Misses 752 743 -9 ☔ View full report in Codecov by Sentry. |
The old code always removed entries and re-inserted them if necessary. The new code will instead modify the value (= data_point count) in-place and only remove the key- value pair from the map if the count would've dropped to zero.
ee7245d
to
35bce3e
Compare
No value of `Infallible` can ever exist, so it is statically proven that `Result<Empirical, Infallible>` can never exist as a `Result::Err` variant. This allows layout optimizations and is arguably a clearer API.
Pushed a breaking change on top of the previous ones. |
Nothing here should be breaking. Some of the changes are opinionated code quality improvements.
Two noticeable improvements from this:
Option<(f64, f64)>
is larger than twof64
s. Up to 8 bytes on x64)BTreeMap::remove
insidefn remove
if value > 1Probably also removes a branch in
fn add
, but I honestly haven't checked the generated ASM or checked via benchmarking. Should I?