An Optimized Diff Algorithm Based on Myers
Virtual DOM technology is the key to efficient rendering of modern front-end frameworks (such as Vue, React), and its performance largely depends on the efficiency of Diff algorithm when comparing and updating new and old virtual nodes. Vue2 uses Diff algorithm based on tree structure, but with the increase of application scale, the current Diff algorithm has performance bottleneck when dealing with complex UI updates and large-scale nodes. To solve this problem, this paper proposes an optimized Diff algorithm based on Myers algorithm to improve the comparative performance of virtual DOM in Vue2 framework. The optimization scheme of this paper combines the minimum editing distance calculation method of Myers algorithm and virtual DOM tree structure, and reduces unnecessary node comparison through multi-level segmentation and difference point prediction mechanism. In addition, a jump strategy is designed to speed up the Diff process in frequent UI update scenarios.
Authors
- S.J. Wan (ORCID: https://orcid.org/0009-0007-4437-2286)
- Zhao-Huan Yu (ORCID: https://orcid.org/0000-0001-5891-9202)
- Yihao Qin (ORCID: https://orcid.org/0000-0003-3257-2524)
- Yu Xin (ORCID: https://orcid.org/0000-0003-0119-2027)
- Huimei Huang (ORCID: https://orcid.org/0000-0002-7231-9278)
Institutions
- Huaibei Normal University (CN)
- Shenyang Institute of Computing Technology (China) (CN)
- University of Chinese Academy of Sciences (CN)
Publication Details
- Published
- 2024-12-13
- DOI
- https://doi.org/10.1109/iccc62609.2024.10941841
- Primary Topic
- Neural Networks and Applications
- Type
- article
- Field-Weighted Citation Impact
- 0.00