https://bugzilla.wikimedia.org/show_bug.cgi?id=50836
Web browser: ---
Bug ID: 50836
Summary: loading a page which requires many fonts, causes high
CPU load
Product: MediaWiki extensions
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: UniversalLanguageSelector
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected],
[email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected]
Classification: Unclassified
Mobile Platform: ---
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.
--
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l