Let's think on that the problem describing as a mind exercise.
First, we can assume the browser running at 60 fps to be a smooth experience.
That means the js have 16.7ms on each tick to run + let the browser recalculate the layout and repaint.
Then, on the scenario you described, facebook have some ways to implement this, like:
The thing is, if at some exact time, the client receives a bunch of messages/comments, let's say, 100 new items, what can happen:
our react component will have an array of msgs, and a loop to render all. We received +100, so, we will render +100 new items on the list. It will basically run the reconcilliation algorithm and, 100 element.appendChild being called on the next tick;
on svelte, it will be exactly the same, 100 appendChild being called. The difference will be svelte already knowing that it needs to run appendChild (in that case, I think it will be insertBefore with an anchor, but we can consider the same);
Svelte implementation to see the insertBefore being called 100 times:
React implementation to see the appendChild being called 100 times:
PS: on both, open the devtools and click on show, haha!
So, yep, the biggest impact will be on diff algorithm and the most important part to consider will be on the behavior you choose to code (receive and render one by one, receive a batch and render all, receive real time or each N seconds).
I am sorry to say but your "haha" is quite irritating. I wonder if it comes under "Code of conduct".
Anyway, before even I think of opening devtools, I would say the DOM structure in your example is nowhere near to real-time updates. Unless the DOM has complex structure Svelte will always be faster. The code that is written in the provided link is synchronous update whereas in realtime we receive lakhs of asynchronous updates for a celebrity live video. Please let's understand the basics of real-time updates.
I would prefer to work on it for a couple of days offline and then discuss again. I wouldn't be able to answer again on this thread. I would be grateful if you also help in closing this for now. Thanks for understanding.
They are nowhere realtime examples and that was judging & rude.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.