by admax88q · 5y ago · 0 comments
They are written in languages with incompatible memory models, so lots of data must be copied when communication. They are running in different runtimes, so your javascript JIt can not inline function calls into the DOM.
That's why to this day, if you want to render a bunch of html from javascript, it is faster to generate a giant strin g of markup and pass that to the browser in a single 'innerHTML = "foo"' and let the browser parse all that, than it is to call a bunch of "createElement(); setAttribute(); appendChild();" calls.
It used to be the case a number of years ago when I last benchmarked.
https://gist.github.com/adamvy/afcace8cbdbe56995626f59f6ea2b...
Load this as a script tag in an html file to run.
Last time I benchmarked this it was true, but that was a number of years ago.
At least in firefox here.
Benchmarking is difficult.