Repository navigation
Conversation
Signed-off-by: 付典 <fudianchn@gmail.com>
The token actions query the wired FeatureConfiguration for every identifier, string literal and quoted identifier; PrimaryExpression pays new predicate checks after every expression. Cache the derived dialect/flag answers on the wired configuration's identity (it is only mutated before parsing starts), lazily allocate the DuckDB chained-sign list, reject non-operator images before the PostgreSQL json-access equals chain, and hoist the unsupported statements flag out of the capture loop. Signed-off-by: 付典 <fudianchn@gmail.com>
Signed-off-by: 付典 <fudianchn@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI disclosure: this change was prepared with AI coding agents.
What
Remove repeated feature-configuration lookups from the per-token and per-expression paths: typed fast paths in
FeatureConfiguration, identity-keyed derived-flag caches in the token manager andSimpleCharStream, lazy allocation of the DuckDB chained-sign list, a cheap first-character rejection inisPostgreSqlJsonAccess, and a hoisted flag check incaptureOpaqueStatements.Why
Every identifier, string literal and quoted identifier paid one or two
EnumMaplookups per token in its lexical action andBeginTokenpaid up to three more;getAsBoolean/getAsLong/getAsIntalso rebuilt strings on every call. The configuration is only mutated before parsing starts (it is wired throughwithConfiguration/getConfiguration), so the derived answers can be cached against the wired configuration's identity.How
getAsBoolean/getAsLong/getAsInt/getAsIntegerreturn storedBoolean/Long/Integervalues directly and keep the string parsing for every other stored type, includingnull.input_stream.featureConfigurationis a different object;SimpleCharStream.BeginTokencaches its three branch answers the same way.innerSignsinPrimaryExpressionis allocated only when a chained sign actually appears.isPostgreSqlJsonAccessrejects images that cannot be one of the four operators with a singlecharAtbefore the equals chain; this runs after every primary expression.Root cause
Not applicable (performance).
Testing
performance.sqlbyte-identical to master (54 statements).parseSQLStatementspaired against master: differences stay within run-to-run noise on my machine (medians -0.6% to +0.7% in same-JVM alternation); the change removes the lookups and allocations mechanically rather than moving the needle of this corpus.Verification of the original issue
Not applicable (no issue).