最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Difference between incremental DOM and virtual DOM in Angular - Stack Overflow

programmeradmin4浏览0评论

I have two questions regarding Angular. I've tried reading some articles but I can't get the idea.

  1. What is incremental DOM?
  2. What is the difference between incremental DOM and virtual DOM?

I have two questions regarding Angular. I've tried reading some articles but I can't get the idea.

  1. What is incremental DOM?
  2. What is the difference between incremental DOM and virtual DOM?
Share Improve this question edited May 15, 2023 at 8:45 Matthias Braun 34.4k27 gold badges152 silver badges176 bronze badges asked Dec 16, 2019 at 8:45 Hiras HarisHiras Haris 4981 gold badge4 silver badges18 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 19

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.

发布评论

评论列表(0)

  1. 暂无评论