http://www.mediawiki.org/wiki/Special:Code/MediaWiki/93515
Revision: 93515 Author: krinkle Date: 2011-07-30 06:33:46 +0000 (Sat, 30 Jul 2011) Log Message: ----------- mediawiki.js request() caching deep level object member access. - Instead of requesting index 0 of dependancies-argument, and the value of that of the registry, and the dependancies object in that of which we read the length property is very deep. Even worse when doing that both in the head and in the body of a for()-loop. - Instead caching reference access to dependancies object of the registry item. - Plus a simple by-value of the length property Modified Paths: -------------- trunk/phase3/resources/mediawiki/mediawiki.js Modified: trunk/phase3/resources/mediawiki/mediawiki.js =================================================================== --- trunk/phase3/resources/mediawiki/mediawiki.js 2011-07-30 06:00:35 UTC (rev 93514) +++ trunk/phase3/resources/mediawiki/mediawiki.js 2011-07-30 06:33:46 UTC (rev 93515) @@ -630,8 +630,12 @@ if ( typeof dependencies === 'string' ) { dependencies = [dependencies]; if ( dependencies[0] in registry ) { - for ( var n = 0; n < registry[dependencies[0]].dependencies.length; n++ ) { - dependencies[dependencies.length] = registry[dependencies[0]].dependencies[n]; + // Cache repetitively accessed deep level object member + var regItemDeps = registry[dependencies[0]].dependencies, + // Cache to avoid looped access to length property + regItemDepLen = regItemDeps.length; + for ( var n = 0; n < regItemDepLen; n++ ) { + dependencies[dependencies.length] = regItemDeps[n]; } } } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs