Learning to be Giant.

React diff是怎么工作的


Facebook前段时间发布的React提供了许多前端开发的新思路,在React当中提出的Virutal DOM和diff据称极大的提高了效率并且在代码写作的时候十分符合直觉,而且基于此的对于DOM的渲染策略让人感到十分有趣。Facebook相关的团队宣称他们使用的启发式算法成功的将树的diff操作从原有的$O(n^3)$降到了$O(n)$。所以,这篇文章综合了最近看到的好多篇关于React渲染的策略的文章,希望能对React的渲染策略有一个较为全面的宏观上的探讨。



  1. React’s diff algorithm
  2. Why is React’s concept of Virtual DOM said to be more performant than dirty model checking?
  3. React Documentation: Reconsiliation
  4. React Demystified

Disclaimer: This is a personal weblog. The opinions expressed here represent my own and not those of any entity with which I have been, am now, or will be affiliated.