Introduce the AST Optimizer

... that can only optimize one thing: combine `| append: 'a' | append: 'b'` into a single `| append_all: ['a', 'b']` filter call.

This avoids all the intermediate allocations caused by several `append`.

Also introduce a new filter `append_all: [*items]`.
This commit is contained in:
Marc-André Cournoyer
2020-10-07 13:47:42 -04:00
parent d250a7f502
commit 0de722968c
4 changed files with 76 additions and 0 deletions
+1
View File
@@ -84,6 +84,7 @@ require 'liquid/usage'
require 'liquid/register'
require 'liquid/static_registers'
require 'liquid/template_factory'
require 'liquid/optimizer'
# Load all the tags of the standard library
#