lifeart / glimmer-next

GXT is `glimmer-vm` runtime alternative, only 7kb gzipped
https://g-next.netlify.app
MIT License
28 stars 3 forks source link

[compiler] reuse tags #148

Open lifeart opened 1 month ago

lifeart commented 1 month ago

If template has case like this:

{{#if this.name}}
   {{this.name}}
   {{format this.name}}
{{/if}}

We create 3 tags for same property this.name. We could avoid it and create one tag.

We could do it in compile-time with let. Or we could replace this. with custom proxy and have caching on this level. In addition, we could transform {{this.name}} to {{get this "name"}} and use something like cellFor

lifeart commented 1 month ago

we should not reuse tags if used inside control flow (if) - https://github.com/lifeart/glimmer-next/pull/149