Skip to content

[FLINK] Replace LinkedList with ArrayDeque and pre-size HashSet in Flink module#11789

Draft
acvictor wants to merge 1 commit intoapache:mainfrom
acvictor:acvictor/flinkMinor
Draft

[FLINK] Replace LinkedList with ArrayDeque and pre-size HashSet in Flink module#11789
acvictor wants to merge 1 commit intoapache:mainfrom
acvictor:acvictor/flinkMinor

Conversation

@acvictor
Copy link
Contributor

What changes are proposed in this pull request?

This PR makes minor collection improvements in Flink by replacing LinkedList with ArrayDeque for the internal row buffer - provides O(1) for add at tail, remove(0) from head with better cache locality than LinkedList which allocates a separate node object per element, and using pre-size HashSet in analyzeJoinKeys to avoid rehashing when the key count exceeds the default capacity (16 initial capacity x 0.75 load factor = rehash after 12 elements).

How was this patch tested?

Existing UTs

Was this patch authored or co-authored using generative AI tooling?

No

@github-actions github-actions bot added the FLINK label Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant