-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: MovingInterquartileMean
#13730
base: main
Are you sure you want to change the base?
Conversation
MovingInterquartileMean
optimizationMovingInterquartileMean
refactor
a274651
to
c35a86c
Compare
So I added yet another optimization (custom Edit: Just realized that the Y-Label is not quite right, its "elements processed per second". Please review. |
MovingInterquartileMean
refactorMovingInterquartileMean
1bc2bb1
to
c4ad157
Compare
This should also optimize speed and memory usage for small-ish windows (which is the only usecase right now)
c4ad157
to
a0fccef
Compare
I decided to drop |
src/util/movinginterquartilemean.cpp
Outdated
// std::queue has no .clear(), so creating a temporary and std::swap is the | ||
// next most elegant solution | ||
std::queue<double> empty; | ||
std::swap(m_queue, empty); |
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.
Wouldn't
std::queue<double>().swap(m_queue);
work too? Not tested.
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.
good catch, yeah that should work.
LGTM! Thank you! |
just noticed I still had some unpushed commits in my tree, it would be nice if could take a look at those too. Thank you. |
what was initially just supposed to be a cleanup/refactor, mutated into a full blown optimization. This is primarily intended as a cleanup though, and I only implemented the benchmark to show that this was not causing regressions in performance. There is still a little more to be done, but these are some preliminary numbers.
Before:
After: