When is a virtual house faster than manual manipulation?

I am studying a virtual house right now, and I am wondering if the virtual house is really faster than manually manipulating the view. Now I understand that the virtual dom and diff algorithm can prevent unnecessary re-threads, for example, when we want to change this:

<div>
    <div>a</div>
    <div>b</div>
</div>

For this:

<div>
    <div>c</div>
    <div>d</div>
</div>

Therefore, when we use direct manipulation, we will probably have 4 re-streams: 2 to delete each div and to create a new one. We will also have more manipulations with dom, because we need to create new elements (perhaps removing from dom → creating new properties dom → -> setting to a document is faster than just editing the properties of dom? Directly). On the other hand, we have a quick comparison algorithm that generates 2 patches only to replace the contents of our divs, maybe we will have 1 re-stream. (if I made a mistake when writing the number of repeated threads, please tell)

, , , 2 , diff, , , diff patch . . , https://github.com/Matt-Esch/virtual-dom : " DOM VTree". , - ?

, , , , , ?

+4
2

, , , , 4 : 2 div .

DOM , (, , ), , , .

, , , .

, , , .

, dom , - (, ) DOM- , .

+3

virtual-DOM, , .

, DOM. .

+1

All Articles