Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
PoC Time series #27
PoC Time series #27
Changes from 11 commits
d1e1dc1
ce8d5a8
3c5bf7d
12a3ccf
4258871
29f0809
c71271c
d10ec0f
545131e
01650db
f33e809
8c63b80
13921b5
9bda05c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
or something like that, to allow for direct lookup? 🤔
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.
mmm...I thinking if we should do one step more at this point. My idea of tags map was something
map[keySepValue]struct{}
for having the maximum efficiency onContains
but it wouldn't support the fetch byTag.Key
.So we could consider this data structure for supporting the single
GetTag(key)
:In this way, we could support most of the operations with one data structure. The unique missing operation is returning the sorted []Tag for example for
GetTags()
, I see two potential solution:order/index
in thestruct
so we know in which specific place set theTag
item.The list of operations we have potentially consider in comparisons:
@na-- Thoughts?
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.
Thinking better on this, it doesn't really work. Because on
Contains
we don't have the relativetag.valhash
to compare. So I think, we can just support theGetTag
by binary search 🤔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.
I am not sure I understand all of your concerns, or maybe I'm missing something 😕 Please correct me if I'm wrong, but we basically need to be able to efficiently access the tags both in a sorted sequential order and in a random access order (i.e. lookup by their key). So, the basic implementation choices are these:
[]Tag
) for efficient sequential access and have an index (map[string]int
) by the key for efficient random accessmap[string]string
) for the efficient random access and have a sorted list of keys as a[]string
slice for the sequential access.The first approach seems preferable to me, since the second one involves an extra map per tag access when iterating across all tags sequentially, and anything else seems unnecessary over-engineering at this early point. 🤷♂️
Given that these time series objects should be measured in thousands at most, and not millions, I don't see why we'd want anything more complicated than this? You probably won't save all that much memory usage if you don't have the index and use binary search, for example, since I think the strings for the keys will be reused between the slice and the map 🤷♂️
Besides, we might be verging in bike-shedding territory here 🙂 . The actual implementation should be internal to the
TimeSeries
object, right? So I don't think it matters very much implementation you pick, we should be able to change it at any time in the future without anything breaking, right?