Hacker News new | ask | show | jobs
by uzerfcwn 29 days ago
> An actual high performance framework should manipulate HTML as a string directly

I also found this 6ish years ago, when I wanted to build a table of some 100k rows from locally cached data. It was an order of magnitude faster to serialize and set innerHTML directly, rather than doing anything related to HTMLElement. The rendering time went from around 30-60 seconds with the naive createElement solution to 2-5 seconds with innerHTML.

Would be cool to see a framework doing that under the hood. Then again, I haven't needed that kind of HTML rendering performance since, so maybe the problem isn't big enough for anyone to care. Haven't tested if the performance numbers even hold up anymore.

1 comments

The modern state is different too because the DOM can optimize <template> tag contents as well or better than string parsing, with the current big caveat being understanding the big performance difference between `document.addChildren(myTemplate.contents.cloneNode())` versus `document.importNode(myTemplate.contents)`.