Skip to content

chore(spanner): reuse CharsetEncoder in ChecksumResultSet#13455

Merged
olavloite merged 1 commit into
mainfrom
spanner-reuse-charset-encoder
Jun 14, 2026
Merged

chore(spanner): reuse CharsetEncoder in ChecksumResultSet#13455
olavloite merged 1 commit into
mainfrom
spanner-reuse-charset-encoder

Conversation

@olavloite

Copy link
Copy Markdown
Contributor

Reuse the CharsetEncoder in ChecksumResultSet to prevent the creation of a new encoder for each string that we encounter.

Reuse the CharsetEncoder in ChecksumResultSet to prevent the creation of a
new encoder for each string that we encounter.
@olavloite
olavloite requested review from a team as code owners June 12, 2026 17:27
@olavloite
olavloite requested a review from sakthivelmanii June 12, 2026 17:27

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request optimizes string encoding in ChecksumResultSet by reusing a CharsetEncoder instance in ChecksumCalculator instead of instantiating a new one on every putString call. The reviewer suggested eagerly initializing the encoder as a final field and directly calling encoder.reset() to simplify the code and avoid unnecessary null checks.

@olavloite
olavloite merged commit cfc6ba7 into main Jun 14, 2026
182 checks passed
@olavloite
olavloite deleted the spanner-reuse-charset-encoder branch June 14, 2026 04:59
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