If you have watched the Vue3 Live Release video, you will know the Vue core team rewrote the diff algorithm.
The new diff algorithm refers to the ivi and inferno, whitch make virtual nodes diff quicker. You can visit this test result to check the accurate data.
As a whole, the algorithm can divide into three parts:
patch the repetitive prefix & suffix nodes
sync the old & new virtual nodes lengths
diff subsequence of the same length
Next, we will explain the algorithm with the source code of Vue3.
这种模式被提出已经很久了,但却并不广为人知。这篇文章的目的就是讲清楚膜编程背后的思想。因为我关于 膜 的很多经验都是建立于 Web 平台的,所以我会主要从 Javascript 和 Web 平台的用例来解释。值得注意的是,膜 模式并不是仅仅针对于 Web 编程提出的概念,它是一个可以广泛应用的模式。
历史: 膜的概念来源于对 Capability-secure Systems 的研究。最早可追溯至功能安全操作系统,例如 KeyKOS。 以及功能安全语言,例如 Joule 和 E。本文对膜的介绍主要基于 Mark S 中的描述。Miller 的 博士论文。膜后来被独立地发明,并被广泛应用于函数式编程社区去实现高阶函数的契约。