Skip to content

perf: size the workflow result map from Workflow#size - #3547

Merged
csviri merged 1 commit into
operator-framework:nextfrom
csviri:workflow-result-map-sizing
Aug 11, 2026
Merged

perf: size the workflow result map from Workflow#size#3547
csviri merged 1 commit into
operator-framework:nextfrom
csviri:workflow-result-map-sizing

Conversation

@csviri

@csviri csviri commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

AbstractWorkflowExecutor called Workflow#getDependentResourcesByName purely to
read its size. That allocates a HashMap and walks every node to collect the
dependent resources, then discards the map. The executor is constructed on
every reconcile and cleanup of a workflow-based reconciler, so use the existing
Workflow#size instead.


Quality-only change: no intended behavior difference. Cut from next and
touches a disjoint set of files from the sibling cleanup PRs, so it can be merged
independently and in any order.

Verified on this branch alone: mvn -o -pl operator-framework-core,operator-framework-junit -am test
(693 core + 6 junit tests, no failures) and mvn spotless:check.

AbstractWorkflowExecutor called Workflow#getDependentResourcesByName purely to
read its size. That allocates a HashMap and walks every node to collect the
dependent resources, then discards the map. The executor is constructed on
every reconcile and cleanup of a workflow-based reconciler, so use the existing
Workflow#size instead.
Copilot AI lite review requested due to automatic review settings August 7, 2026 11:54
@openshift-ci
openshift-ci Bot requested review from metacosm and xstefank August 7, 2026 11:54
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8c0cc15a-cbdb-4986-8828-c6b1c4e28485

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces per-reconcile allocation overhead in the workflow execution path by avoiding creation of a dependent-resources map solely to pre-size the executor’s result map. It leverages DefaultWorkflow#size() (which is backed by dependentResourceNodes.size()) to keep behavior unchanged while eliminating unnecessary work.

Changes:

  • Replace workflow.getDependentResourcesByName().size() with workflow.size() when initializing results in AbstractWorkflowExecutor.
  • Avoid allocating and populating a temporary HashMap of dependent resources during executor construction.

@csviri csviri left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@csviri
csviri merged commit 9272c99 into operator-framework:next Aug 11, 2026
29 checks passed
csviri added a commit that referenced this pull request Aug 28, 2026
AbstractWorkflowExecutor called Workflow#getDependentResourcesByName purely to
read its size. That allocates a HashMap and walks every node to collect the
dependent resources, then discards the map. The executor is constructed on
every reconcile and cleanup of a workflow-based reconciler, so use the existing
Workflow#size instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants