Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prepare.md #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/diff/prepare.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

## Diff的瓶颈以及React如何应对

由于`Diff`操作本身也会带来性能损耗,React文档中提到,即使在最前沿的算法中,将前后两棵树完全比对的算法的复杂程度为 O(n 3 ),其中`n`是树中元素的数量。
由于`Diff`操作本身也会带来性能损耗,React文档中提到,即使在最前沿的算法中,将前后两棵树完全比对的算法的复杂程度为 O(n<sup>3</sup>),其中`n`是树中元素的数量。

如果在`React`中使用了该算法,那么展示1000个元素所需要执行的计算量将在十亿的量级范围。这个开销实在是太过高昂。

Expand Down Expand Up @@ -112,4 +112,4 @@ function reconcileChildFibers(

2. 当`newChild`类型为`Array`,同级有多个节点

在接下来两节我们会分别讨论这两类节点的`Diff`。
在接下来两节我们会分别讨论这两类节点的`Diff`。