jcbrand/converse.js — pull request #3 by ichim-david (2013-02-23 14:39:09+00:00)
Title: Optimize actions done RosterView

Hello,

I have done quite a bit of optimizations to the rendering and any operations that were done to the elements of this view, to name a few:

1. When the render is called, don't empty the list and add all of the models from the collection on every render, instead use the item that was passed to the render. ( this has a big impact on performance especially when scrolling the page as the chat box is loading the roster items, as in that time in Firefox the browser sometimes displayed the script taking too long message since the cpus was going to 80%-100% for the duration of the roster addition).
2. Show the xmppchat-roster only after the last contact was added to the render ( since they come first all with the dummy data of offline ) to avoid seeing all of those dom operations.
3. Sort the items only after the last roster item has been added by offline, and then do a complete sort only after an item presence was modified ( here even a better improvement would be to resort only the elements of the new presence instead of reinserting all of them sorted, perhaps in a future pull request)
4. Perform a sort only after the presence has been changed, not when the resource has been changed
5. Check if subscription and ask is same before adding to model since many times the item it received had the same attributes as the saved model, therefore that model was rendered again useless.
6. Make actual use of remove event instead of relying on the fact that render emptied the list and added them again, giving you the impression that only one operation when done ( like when you say ok to remove a contact from list )

Looking forward to any feedback on these changes