GWicke has uploaded a new change for review.

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


Change subject: Further row back on perf optimization
......................................................................

Further row back on perf optimization

Only test heuristic at start of table cell and -caption attribute production,
but not for each attribute. This basically means that anything is eaten in the
middle of attributes, but should still avoid most backtracking on content.

Parse times on el:Πορεία_των_κυπριακών_ομάδων_στα_κύπελλα_Ευρώπης are
actually improved by this, as the sanity check is executed less often.

Change-Id: I1e982da057d10370972491e5e9b3a1225e5cb79d
---
M js/lib/pegTokenizer.pegjs.txt
1 file changed, 13 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/88/74588/1

diff --git a/js/lib/pegTokenizer.pegjs.txt b/js/lib/pegTokenizer.pegjs.txt
index c13c9ef..08c08d9 100644
--- a/js/lib/pegTokenizer.pegjs.txt
+++ b/js/lib/pegTokenizer.pegjs.txt
@@ -1690,6 +1690,17 @@
         return res;
     }
 
+could_be_attribute = 
+    // quick sanity check before expensive attribute_preprocessor_text_line
+    // production. Also try to parse on [|!+;] for now which seem to be common
+    // syntax errors in production that hidden by the PHP parser (by stripping
+    // the 'attributes').
+    space* ([a-zA-Z|!+;] / 
+            // Possibly a templated attribute
+            '{{' [^}]+ '}'  /
+            // comment or noincludes
+            '<' ('!--' / 'noinclude' / 'onlyinclude' / 'includeonly'))
+
 // A generic attribute that can span multiple lines.
 generic_newline_attribute
   = s:space_or_newline+
@@ -1750,15 +1761,6 @@
 
 generic_attribute_name
   = & { return stops.push( 'equal', true ); }
-    // quick sanity check before expensive attribute_preprocessor_text_line
-    // production. Also try to parse on [|!+;] for now which seem to be common
-    // syntax errors in production that hidden by the PHP parser (by stripping
-    // the 'attributes').
-    &([a-zA-Z|!+;] / 
-            // Possibly a templated attribute
-            '{{' [^}]+ '}'  /
-            // comment or noincludes
-            '<' ('!--' / 'noinclude' / 'onlyinclude' / 'includeonly')) 
     name:attribute_preprocessor_text_line
     {
         stops.pop( 'equal' );
@@ -2099,6 +2101,7 @@
  */
 single_cell_table_args
   = & { return stops.push('pipe', true); }
+    & could_be_attribute
     as:generic_attribute* s:space* p:pipe {
         stops.pop('pipe');
         //console.warn( 'tcargs' + JSON.stringify( as ) + " stops: " + 
pp(stops) );
@@ -2112,6 +2115,7 @@
  */
 row_syntax_table_args
   = & { return stops.inc('tableCellArg'); }
+    & could_be_attribute
     as:generic_attribute* s:space* p:pipe !pipe {
         stops.dec('tableCellArg');
         //console.warn( 'tcargs' + JSON.stringify( as ) + " stops: " + 
pp(stops) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1e982da057d10370972491e5e9b3a1225e5cb79d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: GWicke <[email protected]>

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

Reply via email to