[Performance] Allocate AlignedTVList primitive arrays lazily#18276
Open
jt2594838 wants to merge 2 commits into
Open
[Performance] Allocate AlignedTVList primitive arrays lazily#18276jt2594838 wants to merge 2 commits into
jt2594838 wants to merge 2 commits into
Conversation
HTHou
reviewed
Jul 22, 2026
| @Override | ||
| public synchronized RamInfo calculateRamSize() { | ||
| return new RamInfo( | ||
| timestamps.size(), alignedTvListArrayMemCost(), rowCount, new ArrayList<>(dataTypes)); |
Contributor
There was a problem hiding this comment.
calculateRamSize() still multiplies the number of timestamp blocks by alignedTvListArrayMemCost(), which assumes that every column has a materialized primitive array in every block. That assumption is no longer valid after this change.
HTHou
reviewed
Jul 22, 2026
Comment on lines
+1145
to
1150
|
|
||
| if (acquireArray != 0) { | ||
| // memory of extending the TVList | ||
| memIncrements[0] += | ||
| acquireArray * alignedMemChunk.getWorkingTVList().alignedTvListArrayMemCost(); | ||
| for (TSDataType dataType : dataTypesInTVList) { | ||
| memIncrements[0] += acquireArray * AlignedTVList.valueListArrayMemCost(dataType); | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
This still charges the dense per-block cost for every existing column whenever a new block is acquired, while AlignedTVList.expandValues() now only adds null placeholders and allocates primitive arrays on their first actual write.
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.
Description
Follow-up to #18264. This PR contains only the lazy primitive-array allocation changes on top of the merged dynamic-bitmap implementation.
nullplaceholders for newly added or unwritten aligned columns and allocate eachPrimitiveArrayonly on its first actual write.TsFileProcessormemory accounting for lazy primitive-array allocation.Performance
Compared master
91476b0df7with candidateb7f846ec98:Tests