Skip to content

perf(utils): replace TreeMap with HashMap in MapUtils#14383

Open
MTarek165 wants to merge 2 commits intokestra-io:developfrom
MTarek165:perf/replace-tree-map-with-hash-map-at-map-utils
Open

perf(utils): replace TreeMap with HashMap in MapUtils#14383
MTarek165 wants to merge 2 commits intokestra-io:developfrom
MTarek165:perf/replace-tree-map-with-hash-map-at-map-utils

Conversation

@MTarek165
Copy link
Contributor

@MTarek165 MTarek165 commented Jan 31, 2026

Description

  • TreeMap provides no functional benefit here and only adds sorting overhead.
    flattenToNestedMap() is on a critical path and is invoked at least twice per execution, even when no inputs, outputs, or labels are defined, and may also be triggered indirectly from other paths( like each time creating a new run context by adding execution labels), so for a non trivial executions it is called many times per execution.
  • With thousands of executions with defined inputs/outputs/labels, this introduces unnecessary slight overhead.
  • Using HashMap aligns better with the existing model and avoids this cost.

@github-project-automation github-project-automation bot moved this to To review in Pull Requests Jan 31, 2026
@MilosPaunovic MilosPaunovic added area/backend Needs backend code changes kind/external Pull requests raised by community contributors labels Jan 31, 2026
@MTarek165 MTarek165 changed the title perf(core): replace TreeMap with HashMap in MapUtils perf(utils): replace TreeMap with HashMap in MapUtils Feb 1, 2026
Copy link
Member

@loicmathieu loicmathieu left a comment

Choose a reason for hiding this comment

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

@fhussonnois did you remember if there was some rational to use a TreeMap here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/backend Needs backend code changes kind/external Pull requests raised by community contributors

Projects

Status: To review

Development

Successfully merging this pull request may close these issues.

3 participants