Page MenuHomePhabricator

Semantic Mediawiki extension increases pages load time
Closed, ResolvedPublic

Description

Author: ittayd

Description:
The extension adds many scripts and css references for all pages, even those that don't use any of its features. Although they are cached at the client, it must revalidate them on every load, which causes many connections to be opened.

As a suggestion, http://jimbojw.com/wiki/index.php?title=Doing_more_with_MediaWiki_parser_extensions can be used (for mediawiki versions prior to 0.10)


Version: unspecified
Severity: normal

Details

Reference
bz9974

Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 9:38 PM
bzimport set Reference to bz9974.

The suggested method could indeed be used to limit the usage of the timeline, sorting and tooltip scripts on pages that do not require them. I did not perceive that loading this data could take longer than doing an extra parsing of HTML output on each request.

A core architectural problem of MediaWiki is that the parser cache, while storing many things besides HTML output, cannot hold additional data provided by extensions. Hence the only (and rather unclean method) is to embed data into HTML and to parse this data afterwards. This is also why SMW's Factbox uses only the wiki-language, not the user's language as in the case of the category box.

ittayd wrote:

patch to cache headers in mediawiki 0.10

this patch is my change to the code so header items are added only when needed, using mw 0.10 mechanism for caching them. it works for me.

Attached:

Great. We will incorporate this patch into SMW in time. Since it affects the query processing/printing mechanism which I am currently rewriting, this change will be delayed until this current rewrite is finished.

The increased load times are not only caused by Javascripts, but also by the "clean" programming style of including required PHP files on the top of each file. In this way, most of SMW is loaded on every request. This was changed now in SVN to have only required PHP code being loaded, and this already brings major speed-ups for accessing many pages. Of course the Javascript issue is not forgotten and will also be fixed before the next release.

OK, loading of scripts and CSS now is happening on-demand only (SVN version). Some scripts still can be simplified (they have some ugly dependencies), but many pages should already have far less stuff in their headers. After upgrade, LocalSettings.php should be touched or modified, so that the parser cache is cleared (otherwise some pages may lack scripts).