Old timestamps cause busy loop on Firefox, Internet Explorer and Edge
Summary
On Windows 10 with Firefox 50.0, Internet Explorer 11 or Microsoft Edge, there appears to be some sort of a busy loop whenever a page has old timestamps (e.g. "a month ago"). CPU usage (for one core) goes close to 100%.
Steps to reproduce
Simply open https://gitlab.com/gitlab-org/gitlab-ce/issues?page=270&scope=all&state=opened and observe CPU usage.
Currently, the minimum page number where it happens seems to be 57:
https://gitlab.com/gitlab-org/gitlab-ce/issues?page=57&scope=all&state=opened
It doesn't happen on page 56:
https://gitlab.com/gitlab-org/gitlab-ce/issues?page=56&scope=all&state=opened
The minimum page number will probably change over time.
Debugging
In the minified JS code, the hotspot appears to be here:
function s(o, l, c, u) {
var d = i(l, t);
o.innerHTML = n(d, c, e),
a['k' + u] = setTimeout(function () {
s(o, l, c, u) // debugger pauses almost always here when clicking pause
}, 1000 * r(d))
}
It corresponds to this line in the real source:
function doRender(node, date, locale, cnt) {
var diff = diffSec(date, nowDate);
node.innerHTML = formatDiff(diff, locale, defaultLocale);
// waiting %s seconds, do the next render
timers['k' + cnt] = setTimeout(function() {
doRender(node, date, locale, cnt); // this line
}, nextInterval(diff) * 1000);
}
Sometimes, at least on IE, the debugger gets paused at lazyResize
function which gets called here. I'm not sure if this is related at all.