React Virtual DOM diff algorithm

Source: Internet
Author: User
Tags diff

React virtual DOM: based on diff algorithm platform

Front End: Update status, update view; So the performance problem of front page is mainly caused by Dom operation, and the operation complexity of liberating DOM is urgent.

Because: Dom rendering is slow, and JS parsing compilation is very very very fast! JSG more easily represent nodes

So: The JS and HTML mixed together to solve, react appeared!!!

The diff algorithm is the virtual DOM core:

The traditional diffs algorithm complexity is the secondary level growth, while the react uses the optimized diff algorithm:

Procedure: 1. Node comparison (attributes, text); 2. Record the difference (number), 3. Change (JS);

Optimization points:

Scenario 1: Old parent node and new parent node as long as it's not the same, OK, severed arm! Even if the child node is exactly the same, delete it and render the new node;

Scenario 2: Parent node is the same, compare node properties, text, replace or delete

React Virtual DOM diff algorithm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.