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

enhance: Refactor the expression grammar to improve parsing performance #39875

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xiaocai2333
Copy link
Contributor

issue: #36672

Refactored the ANTLR g4 grammar to improve parsing efficiency:

  • Streamlined rule definitions to eliminate ambiguities.
  • Optimized chain comparisons and operator precedence handling.
  • Reduced redundant parsing paths for logical and arithmetic expressions.

These changes result in faster parser generation and runtime performance.

@sre-ci-robot sre-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines. label Feb 13, 2025
@sre-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: xiaocai2333
To complete the pull request process, please assign congqixia after the PR has been reviewed.
You can assign the PR to them by writing /assign @congqixia in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mergify mergify bot added dco-passed DCO check passed. kind/enhancement Issues or changes related to enhancement labels Feb 13, 2025
@xiaocai2333
Copy link
Contributor Author

Benchmark: 100 range expressions now parse in 1.3ms, down from 11ms.

  • before
BenchmarkA-12    	      99	  11451698 ns/op
  • after:
BenchmarkA-12    	     819	   1308241 ns/op

Signed-off-by: Cai Zhang <[email protected]>
Copy link
Contributor

mergify bot commented Feb 13, 2025

@xiaocai2333 go-sdk check failed, comment rerun go-sdk can trigger the job again.

Copy link

codecov bot commented Feb 13, 2025

Codecov Report

Attention: Patch coverage is 85.79235% with 104 lines in your changes missing coverage. Please review.

Project coverage is 80.08%. Comparing base (0988807) to head (35a1d5c).
Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
internal/parser/planparserv2/parser_visitor.go 85.79% 71 Missing and 33 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #39875      +/-   ##
==========================================
- Coverage   80.11%   80.08%   -0.03%     
==========================================
  Files        1486     1488       +2     
  Lines      205387   205655     +268     
==========================================
+ Hits       164540   164701     +161     
- Misses      34919    35011      +92     
- Partials     5928     5943      +15     
Components Coverage Δ
Client 79.24% <ø> (-0.04%) ⬇️
Core 69.39% <ø> (ø)
Go 81.81% <85.79%> (-0.04%) ⬇️
Files with missing lines Coverage Δ
internal/parser/planparserv2/parser_visitor.go 86.75% <85.79%> (+0.54%) ⬆️

... and 70 files with indirect coverage changes

Copy link
Contributor

mergify bot commented Feb 13, 2025

@xiaocai2333 E2e jenkins job failed, comment /run-cpu-e2e can trigger the job again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-passed DCO check passed. kind/enhancement Issues or changes related to enhancement size/XXL Denotes a PR that changes 1000+ lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants