Marcoil has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/131735

Change subject: Small optimization: Concat child and sibling chunk
......................................................................

Small optimization: Concat child and sibling chunk

Concat child and sibling chunks if the child is done and the ranks of child
and sibling are matching.

Change-Id: I7c67bc699c632d4c7dfa788414612a75279855b8
---
M lib/mediawiki.TokenTransformManager.js
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/35/131735/1

diff --git a/lib/mediawiki.TokenTransformManager.js 
b/lib/mediawiki.TokenTransformManager.js
index fa1c46f..37b6b24 100644
--- a/lib/mediawiki.TokenTransformManager.js
+++ b/lib/mediawiki.TokenTransformManager.js
@@ -1194,6 +1194,12 @@
 
        // Send async if child or sibling haven't finished or if there's sibling
        // tokens waiting
+       if (!ret.async && this.siblingChunks.length
+                       && this.siblingChunks[0].rank === ret.tokens.rank) {
+               var tokens = ret.tokens.concat(this.siblingChunks.shift());
+               tokens.rank = ret.tokens.rank;
+               ret.tokens = tokens;
+       }
        var async = ret.async || this.waitForSibling || 
this.siblingChunks.length;
        this._callParentCB({tokens: ret.tokens, async: async});
 
@@ -1202,7 +1208,9 @@
                // since any tokens we receive now will already be in order
                // and no buffering is necessary.
                this.waitForChild = false;
-               this.emitTokens(this.waitForSibling);
+               if ( this.siblingChunks.length ) {
+                       this.emitTokens(this.waitForSibling);
+               }
        }
 
        return null;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c67bc699c632d4c7dfa788414612a75279855b8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: dom_tpl_params_4
Gerrit-Owner: Marcoil <marc...@wikimedia.org>
Gerrit-Reviewer: GWicke <gwi...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to