Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tokenize SQL before parsing and preserve tokens for recompilation #3323

Merged
merged 4 commits into from
Jan 5, 2022

Conversation

katzyn
Copy link
Contributor

@katzyn katzyn commented Jan 4, 2022

SQL is now tokenized before parsing. Tokens are preserved for second parse if SQL contains an error. Tokens are also stored in prepared commands for re-use if their recompilation is needed. Forward scans now can simply iterate over already known tokens.

Handling of supplementary Unicode characters in identifiers and whitespace is improved.

In long tests with looped TestScript performance on Java 8 is improved by about 1.2–1.5% on warm JVM. Because this test doesn't use recompilation actively, most of its commands don't produce errors, and it contains only few commands where complex forward scans are required I hope we shouldn't have performance degradation caused by these complications with tokens.

I think both Parser and Tokenizer can be improved in the future, but changes in them should be carefully tested, because actual performance impact may be very surprising.

@katzyn katzyn merged commit 13334c2 into h2database:master Jan 5, 2022
@katzyn katzyn deleted the tokenizer branch January 5, 2022 08:12
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.

1 participant