I have two questions regarding angular. I've tried reading some articles but I can't get the idea, What is incremental DOM? what is the difference between incremental DOM and virtual DOM?
Angular doesn't have Virtual DOM, it uses its own mechanism for Change Detection combined with Zones, which helps Angular going through the Change Detection tree from its root to its leaves.
In short, the shadow DOM is a browser technology whose main objective is to provide encapsulation when creating elements. On the other hand, the virtual DOM is managed by JavaScript libraries—e.g., React—and it's mostly a strategy to optimize performance.
React and Vue are using Virtual DOM and Angular use direct DOM rendering system.
AngularJS has directives for binding application data to the attributes of HTML DOM elements.
Incremental DOM is a library for building up DOM trees and updating them in-place when data changes. It differs from the established virtual DOM approach in that no intermediate tree is created (the existing tree is mutated in-place). This approach significantly reduces memory allocation and GC thrashing for incremental updates to the DOM tree therefore increasing performance significantly in some cases.
https://github.com/google/incremental-dom
Virtual DOM compares (diff) a new entire virtual DOM with the previous virtual DOM for changes then applies those changes to the actual DOM. - This approach creates a new virtual DOM to determine the changes (memory heavy).
Incremental DOM has one virtual DOM and walks along the tree to find changes then mutates the virtual DOM and then apply those changes to the actual DOM - (reduced memory size and garbage collection).
Virtual DOM - has a big memory footprint because it needs headroom for changes that "might" happen to the virtual DOM.
Incremental DOM - doesn’t need such a big footprint as memory is only allocated for changes.
Tests have shown that Incremental DOM is fast enough to work even without a virtual DOM also.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With