Inspired by @ianks 's https://github.com/Shopify/liquid/pull/1832 PR, this PR updates the Expression Parser and Tokenizer to use the new StringScanner to improve the performance.
Faster Expression Parser!
Here are the performance improvements by using Expression2
Faster Tokenizer & Expression Parser
Inspired by @ianks 's https://github.com/Shopify/liquid/pull/1832 PR, this PR updates the
Expression
Parser andTokenizer
to use the newStringScanner
to improve the performance.Faster Expression Parser!
Expression2
Benchmark Improvement
main
branch (baseline)fast-expression-parse
branchThis PR improves the parsing speed by ~24%, and parse & render speed by ~19%.
More Benchmark Results!
Here is another benchmarking with a larger and complex theme:
By using the LRU caching, Liquid is creating ~20% less objects, the parsing time is ~18% faster, and render time is ~9% faster.
With production traffic, we are seeing ~14% parsing time improvement: