Loading ...
Sorry, an error occurred while loading the content.

70514Re: Patch 7.3.10

Expand Messages
  • Bram Moolenaar
    Jun 2, 2013
      Dominique Pelle wrote:

      > Bram Moolenaar wrote:
      > > Syntax highlighting of XML with long lines is a lot faster now.
      > Hi
      > I was hoping for faster xml syntax highlighting after reading
      > the above comment, but using :set regexpengine=1 (old engine)
      > is much faster than :set regexpengine=0 (automatic engine).
      > Here is a comparison using vim-7.3.1090 (big) on Linux x86_64:
      > 1/ download this xml file:
      > $ wget http://svn.code.sf.net/p/languagetool/code/trunk/languagetool/languagetool-language-modules/fr/src/main/resources/org/languagetool/rules/fr/grammar.xml
      > 2/ create a simple ~/.vimrc
      > $ cat ~/.vimrc
      > set nocompatible
      > set regexpengine=1
      > filetype on
      > filetype plugin on
      > syntax on
      > 3/ measure (using old regexp engine):
      > $ time vim -c ':norm G' -c ':redraw|q' grammar.xml
      > real 0m3.511s
      > user 0m3.444s
      > sys 0m0.052s

      Did you do this with an older xml syntax file, or the one recently

      > 4/ change "set regexpengine=1" into "set regexpengine=0" in ~/.vimrc
      > 5/ measure the same command again (using new regexp engine):
      > $ time vim -c ':norm G' -c ':redraw|q' grammar.xml
      > real 0m16.429s
      > user 0m16.117s
      > sys 0m0.256s
      > So in this xml example, it's x4.7 slower with the new
      > regexp engine. Is this expected?
      > The grammar.xml file contains a few long lines. Here is the
      > length of the 5 longest lines:
      > $ perl -ne 'print length($_), "\n"' < grammar.xml | sort -n | tail -5
      > 812
      > 924
      > 1217
      > 1343
      > 2312

      I have an XML file where the old engine basically gets stuck and I have
      to press CTRL-C to get back control. With the new engine it now does
      show up.

      The new engine is slower on normal patterns. I first want to make the
      new engine work with all possible regexp features. Then I want to
      automatically fall back to the old engine for patterns where it should
      be faster.

      Also, we should start using the limit on the look-behind matching. The
      XML syntax contains items like this:

      [<]\@<=[^ /!?<>"']\+

      Clearly the look-behind will only work when going back one or two
      characters, going back further won't work. But the engine doesn't know
      that, it goes back to the start of the previous line before it gives up.

      This is much faster:

      [<]\@2<=[^ /!?<>"']\+

      Then the engine give up two bytes before where the match needs to end.

      Another difference between the old and the new engine is that the new
      engine first finds a match with the look-behind. The old engine first
      finds a match with what follows. I'm not sure what works best.

      There is still a lot of speed optimizing to do, but I first want to make
      it work and fix any bugs. It doesn't make sense to optimize something
      that doesn't work.

      The 50-50-90 rule: Anytime you have a 50-50 chance of getting
      something right, there's a 90% probability you'll get it wrong.

      /// Bram Moolenaar -- Bram@... -- 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+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 8 messages in this topic