-
Notifications
You must be signed in to change notification settings - Fork 38
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
PushFixed function for static dataset size #10
base: master
Are you sure you want to change the base?
Conversation
Instead of push simply appending data points to expanding Go slices; this change will allow a rolling window dataset to be analyzed for anomalous signals.
Mixing Push and FixedPush will result in errors, tests prove this problem(not committed yet). I'll leave that for another day when there's free time.
I really like this method and I almost wonder if it would be useful enough for others that an |
I agree, I'd like to have a safe usage of both intermixed, or configurable like you state. However it might just need a re-evaluation of my GoVector code to fix the problem. |
Changed the PushFixed array code to not break if the array was expanded by an external call to the standard Push function. The two functions can now be called in a mixed fashion, and PushFixed will still attempt to use as little memory as possible.
@drewlanenga will need to merge this PR into GoVector in order for the tests I added to pass. |
Took me a little bit to figure out why it's failing.. It's because my PR on GoVector hasn't been merged yet. |
|
||
// PushFixed method will keep the size of the Data vector constant. | ||
// Oldest data points will be evicted as points are added. | ||
// WARNING: Mixing Push() and PushFixed() will result in failure! |
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.
If Push()
and PushFixed()
no longer conflict, probably should remove this warning and the one below, right before the definition of PushFixed()
.
Otherwise 👍 |
ce94e00
to
5ea889d
Compare
Instead of Push simply appending data points to ever expanding Go slices; this change
will utilize GoVector's PushFixed function to keep the array size constant as data points
are added by dropping the oldest event. The goal is to keep memory allocations for long
running processes constantly evaluating anomalies consistent.
eg
Mixing
Push
andFixedPush
for a anomalyzer data set will result in failures. The problem stems from thelen
of an array changing, but thecap
not also being updated. There might be a easy fix another change will need to be made to GoVector.