3 ms·
You can't parallelize DOM updates. All has to happen in the main loop. This is not gonna change for the web as it is today.
by msoad 4y ago
You can't parallelize DOM updates. All has to happen in the main loop. This is not gonna change for the web as it is today.
- afavour 4y agoI don't think that's what OP is saying. They're saying that (e.g.) calculations are made on each appendChild() call when it would be more efficient (when you know you're going to be inserting a ton) to suspend all calculation, insert 1000 nodes, then resume calculations. Something akin to setNeedsLayout() on iOS: https://developer.apple.com/documentation/uikit/uiview/1622601-setneedslayout https://developer.apple.com/documentation/uikit/uiview/16226...
- nickpeterson 4y agoI good parallel might be database development, the difference between taking a cursor and looping through to make changes vs a set based operation that understands how to specify all the needed changes at once.
- overgard 4y agoYes, that's exactly my point, thanks for expressing it better than I could
- overgard 4y agoMy point is that if you change the DOM api itself thats the win. Right now its just individual property updates, so the browser can't know when to delay a computation. So definitely not part of the web today, but it seems worth considering.