see report here:
[[en:Wikipedia:Village_pump_(technical)#Heavy_Javascript_load_after_loading_some_articles.]] (bottom of [[en:WP:VPT]] on July 5 2013. if you don't find it there, look in the archives).
Initial debugging of the issue points to the function injectCSS().
as it turns out, ULS calls injectCSS() once for each required font, which, on some pages (methinks pages with many interwiki links, mainly) can be dozens of times.
apparently, on some browsers injectCSS() can be expensive (maybe the browser re-renders the whole page, in light of the new stylesheet information?) and calling it dozens of times causes high CPU load.
clearly, the right thing to do here is to collect all the different CSS bits and pieces you want to inject, and call injectCSS() exactly once.
this piece of code demonstrate what some people already know: injecting stuff can be habit forming, and can be bad for your health, so you absolutely want to minimize it.
(btw: the function itself is somewhat disgusting. how is it better than
function injectCSS( css ) {
$( '<style>' , {type: 'text/css', rel: 'stylesheet' } )
.text( css )
.appendTo ('head' );
}
really no need to return anything: the single callsite ignores
the return value anyway. anywho, you can prepend "return"
// to make it behave more like existing code if you really want to...
peace.
Version: unspecified
Severity: major
URL: https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_%28technical%29&oldid=563037747#Heavy_Javascript_load_after_loading_some_articles.
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=49935
https://bugzilla.wikimedia.org/show_bug.cgi?id=51073