Skip to content

Commit

Permalink
fixup! refactor: simplify MovingInterquartileMean
Browse files Browse the repository at this point in the history
  • Loading branch information
Swiftb0y committed Oct 31, 2024
1 parent e76069c commit 2e2f9e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util/movinginterquartilemean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

double MovingInterquartileMean::insert(double value) {
// make space if needed
// TODO (Swiftb0y): benchmark and see if it makes sense to optimize here by instead of
// removing + insertion (2x O(n)) (likely large n), we should rotate+swap (O(n)).
// NOTE: after benchmarking, replacing the erase+insert with a rotate+swap does
// not result in significant enough speedup to warrant the complexity.
if (m_list.size() == m_list.capacity()) {
m_list.erase(std::lower_bound(m_list.begin(), m_list.end(), m_queue.front()));
m_queue.pop();
Expand Down

0 comments on commit 2e2f9e6

Please sign in to comment.