Skip to content

Reduce number of calculations when finding a nodes relationships#882

Merged
timja merged 7 commits intojenkinsci:mainfrom
lewisbirks:reduce-computations
Jul 8, 2025
Merged

Reduce number of calculations when finding a nodes relationships#882
timja merged 7 commits intojenkinsci:mainfrom
lewisbirks:reduce-computations

Conversation

@lewisbirks
Copy link
Contributor

Whilst investigating performance issues of #862 it was noticed that node.getEnclosingBlocks() was being called twice in NodeRelationshipFinder#getFirstEnclosingNode. Whilst some of the computation of this result was cached, not all of it was which means there is extra work being done that isn't required.

I also noticed that some maps were being passed around that might have once been used as a lookup table but now were only being used to access values.

Some other small cleanup has been done where newer java functionality is available or the code could be simplified.

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
…f a linked hash map?

Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
… are then sorted, as such just use a collection/list

Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
@lewisbirks lewisbirks requested a review from a team as a code owner July 8, 2025 14:25
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
@timja timja added the bug Something isn't working label Jul 8, 2025
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

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

Thanks all LGTM

@timja timja enabled auto-merge (squash) July 8, 2025 14:33
@timja timja merged commit a7adb78 into jenkinsci:main Jul 8, 2025
17 checks passed
@lewisbirks lewisbirks deleted the reduce-computations branch July 8, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants