4 ms·
I suspect that the nature of the DOM means that being able to do that in the first place would actually require a virtual DOM w/diffing assuming you're targetin
by mst 5y ago
I suspect that the nature of the DOM means that being able to do that in the first place would actually require a virtual DOM w/diffing assuming you're targeting browsers.
However that's probably obvious, so: Assuming you're considering greenfield / blue sky thinking here, it's worth noting that v8 has had so much money and engineering hours sunk into it that the react-ish pseudocode probably doesn't make nearly as many allocations as a naive reading of the code might expect.
(a good friend of mine was very surprised to discover that v8's JIT is good enough that naive javascript code was basically competitive with FFI-ing out to C++ just because the node FFI layer introduced sufficient overhead that the JIT managed to catch up ... I am not a compiler wonk so please don't take this as a remotely expert pronouncement but "it is, in fact, quite difficult to overestimate v8 these days" seems to be a solid heuristic)
- torginus 5y ago>the react-ish pseudocode probably doesn't make nearly as many allocations as a naive reading of the code might expect. Who knows, if V8 manages it to turn it into a for-loop? I don't, but after a quick googling, as of 2018, it certainly didn't: https://github.com/dg92/Performance-Analysis-JS https://github.com/dg92/Performance-Analysis-JS The problem with JS is that the execution model is so nebulous, that performance advice basically boils down to - trust in Google.