Re: Very slow yaml syntax highlighting (7.3.1106)
2015-05-22 11:45 GMT+03:00 Dominique Pellé : > Christian Wellenbrock wrote: > >> I attached a yaml file as example. Please open it with vim to test >> the highlighting speed. Scolling and searching is very slow. >> Tested on vim 7.3.1106 > > Viewing your attached yaml file seems fast for me with vim-7.4.729, > both with 'set re=0' or 'set re=1'. I have relatively recently send an update. If you see help for :h b:yaml_schema then you have this update because I also added support for different schemas then. It also contained a number of fixes to the regexes: most notable is that some regexes no longer care about non-printable characters (YAML definition explicitly disallows them in a number of places and my highlighting was as close to YAML definition as possible, so you got a regex `\%([\n\r\uFEFF \t]\@!\p\)` used in *loads* of places and that was very slow). > > Anyway, looking at vim/runtime/syntax/yaml.vim, I see > several [0-9] in regexp which could be replaced by \d > > This is what :help regexp says: > > === BEGIN QUOTE === > - Matching with a collection can be slow, because each character in > the text has to be compared with each character in the collection. > Use one of the other atoms above when possible. Example: "\d" is > much faster than "[0-9]" and matches the same characters. > === END QUOTE === > > But I wonder whether this piece of advice is still true. > In regexp_nfa.c, I see this comment: > > 1525 /* > 1526 * Try to reverse engineer character classes. For > example, > 1527 * recognize that [0-9] stands for \d and [A-Za-z_] for > \h, > 1528 * and perform the necessary substitutions in the NFA. > 1529 */ > > So probably [0-9] is as efficient now than \d at least with the new > NFA regexp engine. > > With 'set re=0', syntime report says: > > TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN > 0.173880 3490 0.0014650.000498 yamlFloat > [^[\]{}, \t]\@1 0.043657 3490 0.0007980.000125 yamlInteger > [^[\]{}, \t]\@1 0.007699 621602 0.650.12 yamlPlainScalar > \%([^\-?:,[\]{}#&*!|>'"%@`\n\r\uFEFF > 0.004388 621367 0.730.07 yamlBlockMappingKey > \%#=1^\s*\zs\%([^\-?:,[\]{}#&*!|>'"%@ > > 0.004233 3860 0.780.11 > yamlBlockCollectionItemStart ^\s*\zs-\%(\s\+-\)*\s > 0.003241 3860 0.430.08 yamlComment > \%\(^\|\s\)# > 0.003233 3490 0.450.09 yamlNull > [^[\]{}, \t]\@1 0.002419 3860 0.800.06 > yamlBlockMappingMerge ^\s*\zs<<\ze:\%(\s\|$\) > 0.000917 347347 0.130.03 yamlKeyValueDelimiter \s*: > 0.000465 347347 0.050.01 yamlKeyValueDelimiter \s*: > 0.000312 3860 0.070.01 yamlDocumentEnd > ^\.\.\.\ze\%(\s\|$\) > 0.000193 3860 0.020.01 yamlMappingKeyStart ?\ze\s > 0.000166 3860 0.020.00 yamlFlowCollection \[ > 0.000145 3860 0.030.00 yamlDocumentStart > ^---\ze\%(\s\|$\) > 0.000138 3860 0.010.00 yamlDirective > ^\ze%[^\n\r\uFEFF \t]\+\s\+ > 0.000138 3860 0.010.00 yamlAnchor > &[^\n\r\uFEFF \t,[\]{}]\+ > 0.000135 3860 0.010.00 yamlFlowMapping{ > 0.000135 3860 0.010.00 yamlAlias > \*[^\n\r\uFEFF \t,[\]{}]\+ > 0.000129 3860 0.020.00 yamlFlowString ' > 0.000123 3860 0.020.00 yamlFlowString " > 0.000115 3860 0.030.00 yamlNodeTag > !<\%(%\x\x\|[[:alnum:]_\-]\|[#/;?:@&= > > Regards > Dominique > > -- > -- > You received this message from the "vim_dev" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to vim_dev+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Very slow yaml syntax highlighting (7.3.1106)
Christian Wellenbrock wrote: > I attached a yaml file as example. Please open it with vim to test > the highlighting speed. Scolling and searching is very slow. > Tested on vim 7.3.1106 Viewing your attached yaml file seems fast for me with vim-7.4.729, both with 'set re=0' or 'set re=1'. Anyway, looking at vim/runtime/syntax/yaml.vim, I see several [0-9] in regexp which could be replaced by \d This is what :help regexp says: === BEGIN QUOTE === - Matching with a collection can be slow, because each character in the text has to be compared with each character in the collection. Use one of the other atoms above when possible. Example: "\d" is much faster than "[0-9]" and matches the same characters. === END QUOTE === But I wonder whether this piece of advice is still true. In regexp_nfa.c, I see this comment: 1525 /* 1526 * Try to reverse engineer character classes. For example, 1527 * recognize that [0-9] stands for \d and [A-Za-z_] for \h, 1528 * and perform the necessary substitutions in the NFA. 1529 */ So probably [0-9] is as efficient now than \d at least with the new NFA regexp engine. With 'set re=0', syntime report says: TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN 0.173880 3490 0.0014650.000498 yamlFloat [^[\]{}, \t]\@1'"%@`\n\r\uFEFF 0.004388 621367 0.730.07 yamlBlockMappingKey \%#=1^\s*\zs\%([^\-?:,[\]{}#&*!|>'"%@ 0.004233 3860 0.780.11 yamlBlockCollectionItemStart ^\s*\zs-\%(\s\+-\)*\s 0.003241 3860 0.430.08 yamlComment \%\(^\|\s\)# 0.003233 3490 0.450.09 yamlNull [^[\]{}, \t]\@1http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Very slow yaml syntax highlighting (7.3.1106)
Seems a bit better with vim-7.4.712 On Monday, November 10, 2014 at 3:11:58 PM UTC+1, Tomas Mozes wrote: > Just tried 7.4.507, still the same. > > > > On Fri, Nov 7, 2014 at 10:24 PM, Bram Moolenaar wrote: > > > Tomas Mozes wrote: > > > > > On Friday, June 14, 2013 2:58:48 PM UTC+2, Christian Wellenbrock wrote: > > > > I attached a yaml file as example. Please open it with vim to test the > > > highlighting speed. Scolling and searching is very slow. Tested on vim > > > 7.3.1106 > > > > > > Still valid for 7.4.488. > > > > > > This seems to work much better: > > > https://github.com/stephpy/vim-yaml/blob/master/after/syntax/yaml.vim > > > > Have you tried with 7.4.497 or later? It is supposed to fix slowness > > with some patterns. > > > > -- > > Yesterday is history. > > Tomorrow is a mystery. > > Today is a gift. > > That's why it is called 'present'. > > > > /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ > > /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ > > \\\ an exciting new programming language -- http://www.Zimbu.org /// > > \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Very slow yaml syntax highlighting (7.3.1106)
Just tried 7.4.507, still the same. On Fri, Nov 7, 2014 at 10:24 PM, Bram Moolenaar wrote: > > Tomas Mozes wrote: > > > On Friday, June 14, 2013 2:58:48 PM UTC+2, Christian Wellenbrock wrote: > > > I attached a yaml file as example. Please open it with vim to test the > highlighting speed. Scolling and searching is very slow. Tested on vim > 7.3.1106 > > > > Still valid for 7.4.488. > > > > This seems to work much better: > > https://github.com/stephpy/vim-yaml/blob/master/after/syntax/yaml.vim > > Have you tried with 7.4.497 or later? It is supposed to fix slowness > with some patterns. > > -- > Yesterday is history. > Tomorrow is a mystery. > Today is a gift. > That's why it is called 'present'. > > /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net > \\\ > ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ > \\\ > \\\ an exciting new programming language -- http://www.Zimbu.org > /// > \\\help me help AIDS victims -- http://ICCF-Holland.org > /// > -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Very slow yaml syntax highlighting (7.3.1106)
Tomas Mozes wrote: > On Friday, June 14, 2013 2:58:48 PM UTC+2, Christian Wellenbrock wrote: > > I attached a yaml file as example. Please open it with vim to test the > > highlighting speed. Scolling and searching is very slow. Tested on vim > > 7.3.1106 > > Still valid for 7.4.488. > > This seems to work much better: > https://github.com/stephpy/vim-yaml/blob/master/after/syntax/yaml.vim Have you tried with 7.4.497 or later? It is supposed to fix slowness with some patterns. -- Yesterday is history. Tomorrow is a mystery. Today is a gift. That's why it is called 'present'. /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Very slow yaml syntax highlighting (7.3.1106)
On Friday, June 14, 2013 2:58:48 PM UTC+2, Christian Wellenbrock wrote: > I attached a yaml file as example. Please open it with vim to test the > highlighting speed. Scolling and searching is very slow. Tested on vim > 7.3.1106 Still valid for 7.4.488. This seems to work much better: https://github.com/stephpy/vim-yaml/blob/master/after/syntax/yaml.vim -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Very slow yaml syntax highlighting (7.3.1106)
lcd047 wrote: > On 14 June 2013, Ben Fritz wrote: > > On Friday, June 14, 2013 7:58:48 AM UTC-5, Christian Wellenbrock > > wrote: > > > I attached a yaml file as example. Please open it with vim to test > > > the highlighting speed. Scolling and searching is very slow. Tested > > > on vim 7.3.1106 > > > > 1106 is very old news for the new regex engine. At that point Bram was > > still implementing basic functionality. All the speed improvements > > came later. Please try again with 1189 or later. > > With 7.3.1188 highlighting is still >10 times slower with the re=0 > compared to re=1. FWIW. > > /lcd > > > re = 0: > === > > TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN > 0.131778 4630 0.0004440.000285 yamlFloat > \%([\[\]{}, \t]\@!\p\)\@ 0.128999 4630 0.0004140.000279 yamlInteger > \%([\[\]{}, \t]\@!\p\)\@ 0.081751 746716 0.0001510.000110 yamlPlainScalar > \%([\-?:,\[\]{}#&*!|>'"%@`]\@!\%(\%([\n\r\uFEFF \t]\)\@!\p This pattern is just crazy... And it matches nearly everywhere. -- hundred-and-one symptoms of being an internet addict: 205. You're constantly yelling at your spouse, family, roommate, whatever, for using the phone for stupid things...like talking. /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Very slow yaml syntax highlighting (7.3.1106)
On Friday, June 14, 2013 11:49:25 AM UTC-5, Bram Moolenaar wrote: > Christian Wellenbrock wrote: > > > > > I attached a yaml file as example. Please open it with vim to test the > > > highlighting speed. Scolling and searching is very slow. Tested on vim > > > 7.3.1106 > > > > There have been many patches since 1106 to improve regexp speed. > > Please sync to the latest version. > "LCD" posted that with patch 1188 YAML is still 10 times slower. It looks like the main culprits are unbounded negative look-behinds again. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Very slow yaml syntax highlighting (7.3.1106)
Christian Wellenbrock wrote: > I attached a yaml file as example. Please open it with vim to test the > highlighting speed. Scolling and searching is very slow. Tested on vim > 7.3.1106 There have been many patches since 1106 to improve regexp speed. Please sync to the latest version. -- Some of the well known MS-Windows errors: EHUHUnexpected error EUSER User error, not our fault! EGODHorrible problem, god knows what has happened EERRErrornous error: nothing wrong /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Very slow yaml syntax highlighting (7.3.1106)
On 14 June 2013, Ben Fritz wrote: > On Friday, June 14, 2013 7:58:48 AM UTC-5, Christian Wellenbrock > wrote: > > I attached a yaml file as example. Please open it with vim to test > > the highlighting speed. Scolling and searching is very slow. Tested > > on vim 7.3.1106 > > 1106 is very old news for the new regex engine. At that point Bram was > still implementing basic functionality. All the speed improvements > came later. Please try again with 1189 or later. With 7.3.1188 highlighting is still >10 times slower with the re=0 compared to re=1. FWIW. /lcd re = 0: === TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN 0.131778 4630 0.0004440.000285 yamlFloat \%([\[\]{}, \t]\@!\p\)\@'"%@`]\@!\%(\%([\n\r\uFEFF \t]\)\@!\p 0.058324 746433 0.0001520.78 yamlBlockMappingKey ^\s*\zs\%([\-?:,\[\]{}#&*!|>'"%@`]\@!\%(\%([\n\r\uFEFF \t] 0.003512 4630 0.140.08 yamlTimestamp \%([\[\]{}, \t]\@!\p\)\@ 0.000353 4630 0.070.01 level9 ( 0.000345 4630 0.070.01 level4 \[ 0.000344 4630 0.070.01 level12( 0.000341 4630 0.010.01 yamlMappingKeyStart ?\ze\s 0.000340 4630 0.020.01 yamlNodeTag !<\%(%\x\x\|\%(\w\|-\)\|[#/;?:@&=+$,.!~*''()\[\]]\)\+>\|\% 0.000338 4630 0.090.01 level6 \[ 0.000335 4630 0.030.01 level11( 0.000334 4630 0.030.01 level12\[ 0.000334 4630 0.080.01 level1 { 0.000331 4630 0.020.01 level3 { 0.000331 4630 0.030.01 level6 { 0.000331 4630 0.060.01 level9 { 0.000330 4630 0.060.01 level4 { 0.000329 4630 0.060.01 yamlAlias \*\%(\%([\n\r\uFEFF \t,\[\]{}]\)\@!\p\)\+ 0.000329 4630 0.020.01 level10\[ 0.000328 4630 0.060.01 level7 { 0.000327 4630 0.060.01 yamlFlowString " 0.000327 4630 0.010.01 level6 ( 0.000327 4630 0.040.01 level1 \[ 0.000327 4630 0.020.01 level13\[ 0.000326 4630 0.010.01 level12{ 0.000324 4630 0.060.01 yamlFlowMapping{ 0.000324 4630 0.010.01 yamlDocumentStart ^---\ze\%(\s\|$\) 0.000324 4630 0.020.01 level3 \[ 0.000322 4630 0.020.01 level2 ( 0.000322 4630 0.020.01 level8 ( 0.000321 4630 0.020.01 level3 ( 0.000321 4630 0.020.01 level4 ( 0.000320 4630 0.060.01 yamlAnchor &\%(\%([\n\r\uFEFF \t,\[\]{}]\)\@!\p\)\+ 0.000320 4630 0.020.01 level9 \[ 0.000320 4630 0.020.01 level5 { 0.000319 4630 0.080.01 level2 \[ 0.000319 4630 0.020.01 level2 { 0.000317 4630 0.010.01 yamlDirective ^\ze%\%(\%([\n\r\uFEFF \t]\)\@!\p\)\+\s\+ 0.000317 4630 0.020.01 level1 ( 0.000317 4630 0.020.01 level14( 0.000317 4630 0.020.01 level14\[ 0.000317 4630 0.020.01 level8 { 0.000317 4630 0.020.01 level13{ 0.000316 4630 0.020.01 yamlFlowString ' 0.000316 4630 0.030.01 level10{ 0.000315 4630 0.020.01 level5 ( 0.000315 4630 0.020.01 level11{ 0.000314 4630 0.020.01 level7 \[ 0.000313 4630 0.060.01 yamlDocumentEnd ^\.\.\.\ze\%(\s\|$\) 0.000312 4630 0.030.01 level7 ( 0.000312 4630 0.020.01 level10( 0.000311 4630 0.020.01 level13( 0.000310 4630 0.020.01 level8 \[ 0.000310 4630 0.010.01 level11\[ 0.000303 4630 0.010.01 level5 \[ 0.427274 30138 re = 1: === TOTAL COUNT MATCH SLOWEST AVERAGE NAME P
Re: Very slow yaml syntax highlighting (7.3.1106)
On Friday, June 14, 2013 7:58:48 AM UTC-5, Christian Wellenbrock wrote: > I attached a yaml file as example. Please open it with vim to test the > highlighting speed. Scolling and searching is very slow. Tested on vim > 7.3.1106 1106 is very old news for the new regex engine. At that point Bram was still implementing basic functionality. All the speed improvements came later. Please try again with 1189 or later. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.