localvoid / ivi

Lighweight Embeddable Web UI Library
MIT License
724 stars 22 forks source link

can't the `.textContent` optimization be done by the template compiler :thinking:? #66

Closed leeoniya closed 4 days ago

leeoniya commented 4 days ago

hey @localvoid :)

i opened https://github.com/krausest/js-framework-benchmark/pull/1778 to switch over to @ivi/htm and when transferring over the .textContent optimizations, i thought, why can't the compiler do this when it sees a single child node that is known to be string|number|null|undefined from the TypeScript AST?

if this is feasible, the benchmark-gaming optimizations can be just baked into the lib instead of app-space.

localvoid commented 4 days ago

It is definitely possible to add this optimization with TypeScript transformer plugin. But it seems that all modern toolchains are moving away from using tsc for frontend compilation.

leeoniya commented 4 days ago

meh :(