-
Notifications
You must be signed in to change notification settings - Fork 542
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
MQE: don't create copies of native histogram during binary operations #10049
base: main
Are you sure you want to change the base?
Conversation
269b429
to
6eef06d
Compare
6eef06d
to
0173b39
Compare
This is ready for a review, but will require changes to support |
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.
lgtm, but will approve once reworked with the group changes.
I haven't looked closely, but do we have good tests to that would fail if we weren't nil'ing values before returning to the pool appropriately? (Just thinking how we can better test this).
I also imagine this would not work if we every revisited trying not to copy histograms on lookbacks. It might be worth adding a comment somewhere as such.
pkg/streamingpromql/operators/binops/vector_vector_binary_operation.go
Outdated
Show resolved
Hide resolved
0173b39
to
0ac7576
Compare
@@ -47,9 +47,9 @@ func (i *InstantVectorSeriesDataIterator) Reset(data InstantVectorSeriesData) { | |||
// It returns the next point with the lowest timestamp. | |||
// If h is not nil, the value is a histogram, otherwise it is a float. | |||
// If no more values exist ok is false. | |||
func (i *InstantVectorSeriesDataIterator) Next() (t int64, f float64, h *histogram.FloatHistogram, ok bool) { | |||
func (i *InstantVectorSeriesDataIterator) Next() (t int64, f float64, h *histogram.FloatHistogram, hIndex int, ok bool) { |
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.
What do you think about keeping this method as just returning the next values.
Then have a couple of extra methods to getCurrentHIndex
/ getCurrentFIndex
?
I feel like that would be neater and keep the methods clearer on their uses.
0ac7576
to
dba8be3
Compare
What this PR does
This PR removes creating copies of native histogram during binary operations in MQE.
This dramatically improves the performance of binary operations involving native histograms, for example:
This has no noticeable impact on binary operations only on floats, and has no noticeable impact on peak memory consumption.
Which issue(s) this PR fixes or relates to
(none)
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.