perf(spanner-jdbc): cache commonly used query parameter names - #14036
perf(spanner-jdbc): cache commonly used query parameter names#14036olavloite wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a precomputed parameter name cache for indices 1 to 256 in AbstractStatementParser to avoid heap allocations in hot parameter binding loops, updating various classes to use this helper. However, referencing AbstractStatementParser from Statement introduces a circular dependency between the core and connection packages, and is missing an import in Statement.java which will cause a compilation error. It is recommended to move the parameter name cache and utility method to a class within the core package to maintain a clean, unidirectional dependency flow.
Cache the most commonly used query parameter names for positional parameters to prevent the creation of new strings for every single SQL statement execution.
e7ff741 to
d4616c8
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a caching mechanism for positional parameter names (e.g., "p1", "p2") up to index 256 in Statement.java to avoid repetitive string concatenation, updating references across JDBC and parser classes to use this new utility. The review feedback suggests defining a constant for the cache size instead of using magic numbers to improve code maintainability.
Cache the most commonly used query parameter names for positional parameters to prevent the creation of new strings for every single SQL statement execution.