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

Fast expression parse #1844

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fast expression parse #1844

wants to merge 1 commit into from

Conversation

ggmichaelgo
Copy link
Contributor

@ggmichaelgo ggmichaelgo commented Nov 2, 2024

Faster Expression Parser!

Here are the performance improvements by using Expression2
|Expression Type|Performance Improvement|

Expression Type Baseline (iter/s) Optimized (iter/s) Improvement (%)
String 1,585,127.3 1,775,098.1 12.0%
Literal 478,033.9 1,392,155 191.2%
Variable 172,837.7 183,022.3 5.9%
Number 150,488.8 179,076.9 19.0%
Range 58,494.9 67,537.9 15.5%
All 28,498.2 32,861.4 15.3%

Benchmark Improvement

main branch (baseline)

ruby 3.4.0dev (2024-04-23T16:59:11Z v3.4.0-pshopify-pr.. 70b931820e) +YJIT [arm64-darwin23]
Warming up --------------------------------------
              parse:    14.000 i/100ms
             render:    70.000 i/100ms
     parse & render:    11.000 i/100ms
Calculating -------------------------------------
              parse:    143.139 (± 0.0%) i/s    (6.99 ms/i) -      1.442k in  10.074118s
             render:    707.161 (± 0.6%) i/s    (1.41 ms/i) -      7.140k in  10.097056s
     parse & render:    115.156 (± 0.9%) i/s    (8.68 ms/i) -      1.155k in  10.031652s

fast-expression-parse branch

ruby 3.4.0dev (2024-04-23T16:59:11Z v3.4.0-pshopify-pr.. 70b931820e) +YJIT [arm64-darwin23]
Warming up --------------------------------------
              parse:    14.000 i/100ms
             render:    70.000 i/100ms
     parse & render:    11.000 i/100ms
Calculating -------------------------------------
              parse:    145.446 (± 0.7%) i/s    (6.88 ms/i) -      1.456k in  10.010856s
             render:    708.090 (± 0.4%) i/s    (1.41 ms/i) -      7.140k in  10.083630s
     parse & render:    116.499 (± 0.9%) i/s    (8.58 ms/i) -      1.166k in  10.008950s

We see a very small ~1.6% performance boost...
However, with real themes, we will definitely see performance improvements.

@ggmichaelgo ggmichaelgo force-pushed the fast-expression-parse branch 3 times, most recently from 7a3dae2 to 76591a4 Compare November 5, 2024 18:51
@ggmichaelgo ggmichaelgo marked this pull request as ready for review November 5, 2024 19:51
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