Page MenuHomeSealhub

Compiling TSX tags to strings
Open, NormalPublic2 Points

Description

Currently we transpile JSX tags to function calls:

<span>Hello, world!</span>

Becomes something like

TempstreamJSX.createElement("span", {}, ["Hello, world!"]);

It's OK for small documents, but for larger documents having a function call for *every single element* incurs a HUGE performance penalty.

Ideally, we would transform the JSX syntax to strings during compile time whenever feasible. This way we will limit the amount of function calls and increase performance.

There might already be a compiler ready to do the job (a quick search found this: https://github.com/ts-docs/jsx-to-str), but if it turns out that there's a necessity to create a custom compiler from scratch, add 2 points to this task's price.