I'm using socket.io to push data to the browser to update the status of other members (eg: online/offline/away/busy).
I'm finding when the data arrives (every 10seconds) for processing the page hangs for a moment. eg: the browser scroll bar (if your moving it up/down) will stop for a moment and be unresponsive.
I don't believe the issue is the websockets because if I don't process the data (eg: it still arrives at the browser) the browser doesn't hang. it only hangs when I process the data.
below is the loop I'm using to process the data:
I'm aware I could better target the elements to be updated rather then using a generic find (and I will do this) but I'm still very surprised this code causes the site the hang for a moment when used.
The data sent would be around 100 user/status updates so I assume it would loop through this around 100 time and have to search the DOM 100 times. Is this the reason it hangs? Wouldn't it process this in the background?
I guess I'm trying to understand why the hanging occurs. I've used jQuery a lot and never experienced this hanging. All advise/ideas would be greatly appreciated.