4 ms·
> DOM manipulation and queries will always be far far slower than the logical equivalent in JavaScript. That really depends on what you're doing. Reimplementi
by bzbarsky 8y ago
> DOM manipulation and queries will always be far far slower than the logical equivalent in JavaScript.
That really depends on what you're doing.
Reimplementing querySelector in JavaScript (even if you do it on top of JS-only node representations, not on actual nodes) is likely to be slower than the built-in version, for example.
If you're doing a "modify-read-modify-read" cycle, then things are different because the contract is different: the DOM promises that reads will see all modifications, while some of the other systems built around it don't.
> Is it not really saving us much in Firefox?
It really depends on the shape of your workload. There are various cases where React's virtual DOM is pure overhead and just makes things slower.
[Disclaimer: I work on a browser rendering engine, and have done a fair amount of performance work, so I may have my biases about what I see in profiles.]