-
Notifications
You must be signed in to change notification settings - Fork 35
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
Fix multiple bin for float binsize bug. #48
Conversation
Remove unused variables i, x
Fix duplicate bin bug for float binsize due to round-off
Bugfix: n is float
The fix introduces a regression - test Also, in order to merge this PR it must provide a new test case which demonstrates the bug you are fixing, i.e. the test should fail without your fix and should pass after the fix. The example in #46 is a good starting point for the new test. |
Bugfix zero range for option binsize. Unique treatent of options binsize and nbins. Additional test case for float binsize bug.
My last commit solves the regression and adds the required test case. |
I have slightly refactored/simplified the code. |
By using nmax and setdefault for all rng up to nmax floats have to be compared again.
… Am 17.11.2020 um 23:09 schrieb Piotr Janiszewski ***@***.***>:
I have slightly refactored/simplified the code.
I have also refactored unit tests so that the test case you contributed can be used in more tests.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
That is true, but we are talking about extremely cheap operations. Like, nanoseconds cheap. Take >>> d = {}
>>> %timeit d.setdefault(5, 0.0)
# 81.6 ns ± 0.362 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each) So the performance hit of doing some extra iterations in lines 158-159 is negligible. And it is probably comparable to the cost of doing a set difference (line 157 before the refactor). But by swapping the |
There are many micro-optimisations you could do, eg drop the The benefit is still likely to be small, but since I have used the rainflow routine on many GB of data, all improvements are nice... |
Thank you for your contribution @CWE0 |
@gsokoll, feel free to submit a pull request with performance optimizations. |
This PR is included in v3.0.1 on PyPI. |
Assures that each float rng is computed only once and no comparison between two float rng is required.
In addition unused variables i,x are removed.
Addresses issue #46.