dfilatov / vidom

Library to build UI based on virtual DOM
MIT License
415 stars 16 forks source link

render children after injection to DOM #90

Closed ghost closed 9 years ago

ghost commented 9 years ago

...

dfilatov commented 9 years ago

I don't understand how localvoid/vdom-benchmark#15 (comment) is related to rendering after appending. There's written about using of innerHTML for IE. What do you mean by "You would avoid touching the DOM for every child". How? I don't understand how is possible to append child to parent node without touching DOM?

dfilatov commented 9 years ago

"Maybe it is because" — it's not enough. Do you have real benchmarks proving that?

dfilatov commented 9 years ago

I there defined var rootNode = new Node(dom); only once, and after that I do render(rootNode); if the root node don't exist. Else I do this: render(dom.rootNode); where the rootNode is the parent node where you inherit from.

I don't understand completely what you have written about.

dfilatov commented 9 years ago

I see the following:

render: таймер запущен show:161
render: 3.09мс show:163
render: таймер запущен show:161
render: 0.96мс show:163
render: таймер запущен show:161
render: 0.65мс show:163
render: таймер запущен show:161
render: 0.63мс show:163
render: таймер запущен
render: 3.69мс show:163
render: таймер запущен show:161
render: 2.96мс show:163
render: таймер запущен show:161
render: 4.48мс show:163
render: таймер запущен
...

I don't understand what it is and what it proves.

dfilatov commented 9 years ago

What do you compare with? I need to see the same test with vidom.

dfilatov commented 9 years ago

You can make two simple tests to prove your point. The first, when children DOM is rendered before node is appended to parent and the second, when children DOM is rendered after node is appended to parent.

dfilatov commented 9 years ago

https://github.com/dfilatov/vidom/blob/master/lib/client/mounter.js#L27 -- root node is injected after all inner DOM is rendered. I think we don't understand each other, at least me. To improve understanding I suggest you to create two simple tests as I written above.

dfilatov commented 9 years ago

And what? You have given two completely different tests. How can they be compared?

Once more, please, I suggest you to make two simple and CLEAN tests (without any mess).

dfilatov commented 9 years ago

DOM is touched only once when the root virtual node is mounted. All children are already rendered by that moment so there's no redundant DOM operations.

dfilatov commented 9 years ago

in IE citojs is faster cause renders dom via string