Skip to content

Conversation

@ORybak5
Copy link
Contributor

@ORybak5 ORybak5 commented Jan 12, 2026

What

Caching unmarshaller in XmlUnmarshallUtil class

Why

Creating unmarshallers is a very expensive operation and it takes (unnecessarily) a lot of resources. Once we create an unmarshaller it should be cached and reused for better efficiency.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Internal change (non-breaking change with no effect on the functionality affecting end users)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the Changelog with details of my change in the UNRELEASED section if this change will affect end users
  • A corresponding change has been made to the Mapping Documentation repository

@github-actions
Copy link

github-actions bot commented Jan 12, 2026

Images built and published to ECR using a Build Id of PR-925-fd807bc

@github-actions
Copy link

  • Surviving mutants in this change: 2
  • Killed mutants in this change: 16
class surviving killed
🧟uk.nhs.adaptors.pss.translator.util.XmlUnmarshallUtil 2 1
💯uk.nhs.adaptors.pss.translator.util.ResourceReferenceUtil 0 15

See https://pitest.org

@ORybak5 ORybak5 marked this pull request as ready for review January 16, 2026 13:06
@ORybak5 ORybak5 requested a review from a team as a code owner January 16, 2026 13:06
@MartinWheelerMT
Copy link
Collaborator

Can we improve the description / why / what of this PR please.

The what should describe what has been done - i.e:

  • Refactored SomeMethod in SomeFile.
  • Removed ThisFile as no longer needed.
  • Added XML files for new test cases etc.

The why should be the reasoning for this changes - i.e.:

  • SomeMethod was being used to select the last item from a list by parsing all values, it is more efficient to simply read the last values directly.
  • Removed files which are no longer in use due to test refactoring.
  • Mutation testing revealed two areas of concern, which are now covered by additional tests.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This file still has places where we have assertions such as: assertThat(references.size()).isOne() which is less efficient than assertThat(references).hasSize(1)

@ORybak5 ORybak5 merged commit b3b2753 into main Jan 19, 2026
19 checks passed
@ORybak5 ORybak5 deleted the NIAD-3416-perf-improvements branch January 19, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants