Skip to content

perf(spanner): reduce autoboxing when reading data#12741

Merged
olavloite merged 1 commit intomainfrom
spanner-reduce-auto-boxing
Apr 10, 2026
Merged

perf(spanner): reduce autoboxing when reading data#12741
olavloite merged 1 commit intomainfrom
spanner-reduce-auto-boxing

Conversation

@olavloite
Copy link
Copy Markdown
Contributor

AbstractStructReader and Struct contained multiple method definitions and calls that would trigger unnecessary object creation and auto-boxing on the happy path. This change removes those, sometimes at the expense of some duplicate code. This however reduces the number of object creations for the happy flow, which is by far the most used code path.

@olavloite olavloite requested review from a team as code owners April 10, 2026 09:35
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 refactors validation logic in AbstractStructReader and Struct by replacing Guava's checkState with manual exception throwing and utilizing ImmutableList and Type constants to reduce object allocation. It also introduces method overloads for validation that use column indices for error messages. Feedback highlights that changing the parameter type from Object to String in the protected checkNonNull method is a breaking change for subclasses and suggests maintaining backward compatibility by keeping the original signature as a deprecated overload.

AbstractStructReader and Struct contained multiple method definitions and calls that
would trigger unnecessary object creation and auto-boxing on the happy path. This
change removes those, sometimes at the expense of some duplicate code. This however
reduces the number of object creations for the happy flow, which is by far the most
used code path.
@olavloite olavloite force-pushed the spanner-reduce-auto-boxing branch from 7ffb87b to d612ce4 Compare April 10, 2026 09:58
@olavloite olavloite merged commit 6b83871 into main Apr 10, 2026
102 of 103 checks passed
@olavloite olavloite deleted the spanner-reduce-auto-boxing branch April 10, 2026 11:03
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