Skip to content

QFJ-1283 Deduplicate checksum calculation - #1309

Open
kangdaeun1022 wants to merge 3 commits into
quickfix-j:masterfrom
kangdaeun1022:fix/1283-deduplicate-checksum-calculation
Open

kangdaeun1022 wants to merge 3 commits into
quickfix-j:masterfrom
kangdaeun1022:fix/1283-deduplicate-checksum-calculation

Conversation

@kangdaeun1022

@kangdaeun1022 kangdaeun1022 commented Aug 25, 2026 •

Copy link
Copy Markdown

Summary

  • centralize the string-equivalent checksum loop in MessageUtils
  • reuse the allocation-free CharSequence path from Message#setChecksum and FieldMap#calculateChecksum
  • preserve byte-based checksum calculation for multibyte charsets
  • add regression coverage for the StringBuilder fast path, UTF-8 encoded bytes, and repeating-group checksum consistency

Optimization rationale

The shared helper accepts CharSequence, so Message#setChecksum operates directly on its existing StringBuilder without creating a String or byte[]. String-equivalent charsets continue to use direct character traversal, while non-string-equivalent charsets continue to calculate the checksum from encoded bytes.

Testing

  • ./mvnw -pl quickfixj-base -Dtest=FieldMapTest,MessageUtilsTest test -Dmaven.javadoc.skip=true -PskipBundlePlugin (16 tests)
  • ./mvnw -pl quickfixj-base test -Dmaven.javadoc.skip=true -PskipBundlePlugin (170 tests)

Fixes #1283

@codecov

codecov Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.00%. Comparing base (db43e4d) to head (d4313d2).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1309      +/-   ##
============================================
+ Coverage     70.80%   71.00%   +0.19%     
- Complexity     2271     2276       +5     
============================================
  Files           161      161              
  Lines          9077     9073       -4     
  Branches       1192     1189       -3     
============================================
+ Hits           6427     6442      +15     
+ Misses         2197     2175      -22     
- Partials        453      456       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kangdaeun1022
kangdaeun1022 marked this pull request as ready for review August 25, 2026 17:43

@the-thing the-thing left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good.

This branch has not been deployed

No deployments
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.

Code duplication - checksum calculation

2 participants