Rather than creating DOM nodes in JavaScript, an AoT system can extract the html, deliver as html, and then only need reference the relevant DOM nodes in JavaScript. This has a number of performance benefits:
- It takes advantage of fast parsing of html by the browser and avoids the additional JavaScript bundle size and parsing tax.
- Only elements involved in binding need to be managed or even referenced
- Faster mechanisms like
cloneNode
can be used to produce cheaper copies - Like html templates can be consolidated
Based on the current Svelte 3.0 output, it seems well poised to take advantage of this.