Open ghost opened 3 years ago
Parsing the Template Occurs Ahead-of-time: Parsing the template into function calls occurs AOT in XSX and occurs at runtime using native TTL. This runtime parsing incurs a performance cost.
I'd like to note that even if you add a transpiler for TTL in your AOT step, JSX still has more perf real estate since it's baked into tsc/deno
Even if we wrote the AOT TTL transpiler in Rust and used it as a plugin?
It's still an extra step, thus less benefits as opposed to JSX
Even if we wrote the AOT TTL transpiler in Rust and used it as a plugin?
@lmnsoftware I won't do a rust plugin and introduce unstable
into our code although there is deno_swc that parse source to AST (using wasm so no unstable
) (https://github.com/nestdotland/deno_swc/blob/wasm/examples/parse.ts) and then we could visit template literals and implement a js TTL parser for parsing the string.
But, I agree with @jeroenptrs, JSX > TTL in terms of native support & perf
After reading about TSX/JSX on the official TypeScript website, and a long conversation on the DFF discord channel, I'm now convinced that TSX/JSX (I'll call it XSX from now on) is a better option than tagged template literals (which I'll call TTL) for a templating mechanism. Here's why: