jenkins-bot has submitted this change and it was merged.

Change subject: mw.loader.store: do one eval per batch, rather than one per 
module
......................................................................


mw.loader.store: do one eval per batch, rather than one per module

Concatenating module implementations and calling $.globalEval on the result is
reproducibly faster for me than calling $.globalEval for each module.

Change-Id: I70e5bcedb43cd1331720a8e5e6c52cfeabb41ab7
---
M resources/mediawiki/mediawiki.js
1 file changed, 6 insertions(+), 4 deletions(-)

Approvals:
  Krinkle: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/mediawiki/mediawiki.js b/resources/mediawiki/mediawiki.js
index acda5d6..dfb90cc 100644
--- a/resources/mediawiki/mediawiki.js
+++ b/resources/mediawiki/mediawiki.js
@@ -1227,7 +1227,7 @@
                                 */
                                work: function () {
                                        var     reqBase, splits, 
maxQueryLength, q, b, bSource, bGroup, bSourceGroup,
-                                               source, group, g, i, modules, 
maxVersion, sourceLoadScript,
+                                               source, concatSource, group, g, 
i, modules, maxVersion, sourceLoadScript,
                                                currReqBase, currReqBaseLength, 
moduleMap, l,
                                                lastDotIndex, prefix, suffix, 
bytesAdded, async;
 
@@ -1256,14 +1256,16 @@
 
                                        mw.loader.store.init();
                                        if ( mw.loader.store.enabled ) {
+                                               concatSource = [];
                                                batch = $.grep( batch, function 
( module ) {
                                                        var source = 
mw.loader.store.get( module );
                                                        if ( source ) {
-                                                               $.globalEval( 
source );
-                                                               return false; 
// Don't fetch
+                                                               
concatSource.push( source );
+                                                               return false;
                                                        }
-                                                       return true; // Fetch
+                                                       return true;
                                                } );
+                                               $.globalEval( 
concatSource.join( ';' ) );
                                        }
 
                                        // Early exit if there's nothing to 
load...

-- 
To view, visit https://gerrit.wikimedia.org/r/92499
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I70e5bcedb43cd1331720a8e5e6c52cfeabb41ab7
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to