function NewsFeedRefresh() { window.clearTimeout(oTimerNewsFeed) var lcID="" var ldDate=null var lnLength=oNewsFeed.length var lnNoLanguage=0 var loID=null loDivNewsFeed=document.getElementById("DivNewsFeed") if (loDivNewsFeed) { } else { return true } if (lnLength==0) { oTimerNewsFeed=setTimeout("NewsFeedRefresh()",60000) return true } for (lnCounter=0; lnCounter<lnLength; lnCounter++) { lcID=oNewsFeed[lnCounter][1] ldDate=oNewsFeed[lnCounter][2] lnNoLanguage=oNewsFeed[lnCounter][3] loID=document.getElementById("LX"+lcID+"Time") if (loID) { loID.innerHTML=SinceWhen(ldDate,lnNoLanguage) } } oTimerNewsFeed=setTimeout("NewsFeedRefresh()",60000) } function SinceWhen(tdDate,tnNoLanguage) { var lcTime="" var ldDateNow=new Date() var lnDay=0 var lnHour=0 var lnMillisecond=0 var lnMillisecond2=0 var lnMillisecond3=0 var lnMinute=0 var lnRemaining=0 var lnSecond=0 lnMillisecond2=ldDateNow.getTime() lnMillisecond3=tdDate.getTime() lnMillisecond=lnMillisecond2-lnMillisecond3 lnSecond=parseInt(lnMillisecond/1000) lnDay=parseInt(lnSecond/86400) lnRemaining=lnSecond-(lnDay*86400) lnHour=parseInt(lnRemaining/3600) lnRemaining=lnRemaining-(lnHour*3600) lnMinute=parseInt(lnRemaining/60) lnSecond=lnRemaining-(lnMinute*60) switch (tnNoLanguage) { case 1: if (lnDay>0) { if (lnDay==1) { lcTime="Yesterday" } else { lcTime=lnDay+" days ago" } } else { if (lnHour>0) { if (lnHour==1) { lcTime="One hour ago" } else { lcTime=lnHour+" hours ago" } } else { if (lnMinute>0) { if (lnMinute==1) { lcTime="One minute ago" } else { lcTime=lnMinute+" minutes ago" } } else { if (lnSecond<10) { lcTime="Just now" } else { lcTime=lnSecond+" seconds ago" } } } } break case 2: if (lnDay>0) { if (lnDay==1) { lcTime="Hier" } else { lcTime="Il y a "+lnDay+" jours" } } else { if (lnHour>0) { if (lnHour==1) { lcTime="Il y a une heure" } else { lcTime="Il y a "+lnHour+" heures" } } else { if (lnMinute>0) { if (lnMinute==1) { lcTime="Il y a une minute" } else { lcTime="Il y a "+lnMinute+" minutes" } } else { if (lnSecond<10) { lcTime="Maintenant" } else { lcTime="Il y a "+lnSecond+" secondes" } } } } break } return lcTime }Something is very slow here if I have about 200 items on the page. I would have expected that to slow around 40,000. Anyone would have an idea on how to optimize this logic to avoid this javascript latency?