Hacker News new | ask | show | jobs
by hajile 1797 days ago
vdom has the potential to do optimizations that simply aren't possible in individual functions because it sees the whole DOM at one time.

There's also the preact method which diffs against the DOM directly, so that overhead goes away.

Do you remember when InfernoJS broke the framework test? It blew away 2-3 versions of vanillaJS with it's vdom implementation. They literally tore apart what it was doing in order to finally create a vanilla version that was faster, but very unmaintainable.

Today, "native" frameworks like Svelte are only fractionally faster at synthetics. At the same time, each component contains a brand new set of functions which has two major drawbacks. First, code size grows at F x N (where F is framework size and N is your normal code) rather than F + N. Linked to this is the performance implications. Once the JIT warms up the vDOM code (almost instantly), the user gets max performance for the most critical loops when visiting pages for the first time. With "native" frameworks, each new page means switching back to completely unoptimized code.

1 comments

FxN was quite funny, must be a really bad framework that grows like that.