So, whenever any data changes, the whole dataset will be passed to
the bottom and the children will update themselves accordingly.
This is efficient in React because of its virtual DOM. But in Blaze,
this is inefficient. That’s because, whenever any data changes, the
whole template will be re-rendered. Which leads to cascade re-renders.
(…) in Blaze there is actually no performance benefit at all to splitting
things into multiple templates - it does a pretty good job of
rerendering only the smallest part of the page necessary. So often the
result is similar to what React gets via virtual DOM, but with
fine-grained data tracking instead.
If a change in data context doesn’t rerender the whole template, where exactly lies the difference?
whenever any data changes, the whole template will be re-rendered
can be considered right or wrong depending on the meaning of template re-rendering.
If template re-rendering only means the Blaze sub-task consisting of updating the DOM, then I agree with @sashko: Blaze does a terrific job at updating only the smallest part of the DOM (this is the main reason why I love Blaze). In that sense, I think @arunoda’s sentence is wrong.
If template re-rendering means the full Blaze activity consisting of:
parsing the whole template to determine which DOM elements to update,
calling all template helpers,
updating the DOM.
then @arunoda’s sentence is right. However, in that case the inefficiency is not in Blaze, but in people relying too much on heavy template helpers that will be called again and again whenever data context changes.
I mean when passing data context to the template. Either with a dynamic template or using with.
I that case, it anything changes whole templates will be changed.
Since we use dynamic templates on the root of the template TREE, this is a huge issue.