[CASSANDRA-21289][trunk] Avoid capturing lambda allocation in UnfilteredSerializer.deserializeRowBody#4710
Closed
netudima wants to merge 1 commit into
Closed
[CASSANDRA-21289][trunk] Avoid capturing lambda allocation in UnfilteredSerializer.deserializeRowBody#4710netudima wants to merge 1 commit into
netudima wants to merge 1 commit into
Conversation
frankgh
reviewed
Apr 10, 2026
maedhroz
reviewed
Apr 10, 2026
maedhroz
reviewed
Apr 10, 2026
| throw (IOException) e.getCause(); | ||
|
|
||
| throw e; | ||
| } |
Contributor
There was a problem hiding this comment.
nit: Given the helper doesn't already fall off the stack when this method is done, we could add...
...
finally
{
// Avoid retaining references longer than necessary
helper.in = null;
helper.header = null;
helper.builder = null;
helper.livenessInfo = null;
}
I guess we'll just be overwriting these 4 every time we process a new row, so maybe it's not a big deal.
Contributor
Author
There was a problem hiding this comment.
yes, it is overridden frequently for every row, so I think the benefit of early ref cleanup is low here, taking in account:
- header is long living object
- helper.in is also going to live together with helper after the re-use change in CASSANDRA-21296
- livenessInfo is light
- builder is re-used for a partition
also, technically writes are not totally free (due to GC barriers), so I would avoid extra ones for very frequent cell level logic.
maedhroz
approved these changes
Apr 10, 2026
Contributor
maedhroz
left a comment
There was a problem hiding this comment.
LGTM, just left a couple nits
21f994a to
958eb59
Compare
…RowBody The same idea was applied previously in UnfilteredSerializer#serializeRowBody. A state is passed into a consumer function using the existing helper object. patch by Dmitry Konstantinov; reviewed by Caleb Rackliffe, Francisco Guerrero for CASSANDRA-21289
958eb59 to
2b991a6
Compare
Contributor
Author
|
committed as b09bc8b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Avoid capturing lambda allocation in UnfilteredSerializer.deserializeRowBody
The same idea was applied previously in UnfilteredSerializer#serializeRowBody. A state is passed into a consumer function using the existing helper object.
patch by Dmitry Konstantinov; reviewed by TBD for CASSANDRA-21289