Remove samplesPerChunk from memSeries#12390
Conversation
Signed-off-by: Justin Lei <justin.lei@grafana.com>
There was a problem hiding this comment.
FWIW LGTM.
Maybe at this point we could consider creating a struct:
type appendOpts struct {
chunkDiskMapper *chunks.ChunkDiskMapper
chunkRange int64
samplesPerChunk int
}Because those 3 are passed down through a lot of methods and it would make them more readable IMO:
-func (s *memSeries) append(t int64, v float64, appendID uint64, chunkDiskMapper *chunks.ChunkDiskMapper, chunkRange int64, samplesPerChunk int) (sampleInOrder, chunkCreated bool)
+func (s *memSeries) append(t int64, v float64, appendID uint64, opts appendOpts) (sampleInOrder, chunkCreated bool)Edit: maybe chunkOpts:
type chunkOpts struct {
diskMapper *chunks.ChunkDiskMapper
range int64
samples int
}Because those 3 are passed down through a lot of methods and it would make them more readable IMO:
-func (s *memSeries) append(t int64, v float64, appendID uint64, chunkDiskMapper *chunks.ChunkDiskMapper, chunkRange int64, samplesPerChunk int) (sampleInOrder, chunkCreated bool)
+func (s *memSeries) append(t int64, v float64, appendID uint64, chunk chunkOpts) (sampleInOrder, chunkCreated bool)There was a problem hiding this comment.
LGTM nice catch @colega and work @leizor
I'm going to approve and merge this one for now because it brings the optimization now() and also because I leave for a short vacation tomorrow. That said, I also like the idea of grouping the arguments in a struct to only pass that struct down. So lets see if we can have this done in a separate PR :)
|
I like the |
Signed-off-by: Justin Lei <justin.lei@grafana.com>
Follow-up to #12055, specifically #12055 (comment).
Removing
samplesPerChunkfrom memSeries as it implies that it's a value that can change per memSeries and this saves 8 bytes per series in memory.I think it might still be conceptually murky to be passing in the
samplesPerChunkvalue into the append functions, but there's precedent in how we're passingchunkRangein; it's also a value that is configured inHeadOptionsand AFAICT doesn't vary between different memSeries.