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

Re: (patch) new regexp

Expand Messages
  • James Vega
    ... Based on previous discussions on the list, I don t think that s the intended behavior either. I m pretty sure the logic is If NFA compiler worked, return
    Message 1 of 15 , Apr 3 6:48 AM
    • 0 Attachment
      On Thu, Apr 03, 2008 at 06:16:32AM -0700, char101 wrote:
      >
      > On Apr 3, 1:41 pm, char101 <peac...@...> wrote:
      > > the resulting gvim executable seems to be losing its regex capability,
      > > for example typing abc and then searching for a does not work.
      >
      > After debugging the executable, it seems that the fault was 100%
      > mine :D
      >
      > There is a compile error on regexp.c on this function which initial
      > content was
      >
      > + regprog_T *
      > +vim_regcomp(expr, re_flags)
      > + char_u *expr;
      > + int re_flags;
      > +{
      > + regprog_T *prog = nfa_regengine.regcomp(expr, re_flags);
      > +
      > + return prog ? : bt_regengine.regcomp(expr, re_flags);
      > +}
      >
      > and without much thought I just change it into
      >
      > return prog ? NULL : bt_regengine.regcomp(expr, re_flags);
      >
      > which should actually be
      >
      > return prog ? bt_regengine.regcomp(expr, re_flags) : NULL;

      Based on previous discussions on the list, I don't think that's the
      intended behavior either. I'm pretty sure the logic is "If NFA compiler
      worked, return that otherwise return the BT compiled regex." This would
      translate to:

      return prog ? prog : bt_regengine.regcomp(expr, re_flags);

      --
      James
      GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan@...>
    • char101
      ... Thanks James, I changed it, works fine now Benchmark result using ext-js.vim (507 849 Bytes javascript file) Try1: Gvim.exe: 11.1533138743 Gvim-re.exe:
      Message 2 of 15 , Apr 3 7:26 AM
      • 0 Attachment
        On Apr 3, 8:48 pm, James Vega <james...@...> wrote:
        > Based on previous discussions on the list, I don't think that's the
        > intended behavior either.  I'm pretty sure the logic is "If NFA compiler
        > worked, return that otherwise return the BT compiled regex."  This would
        > translate to:
        >
        >   return prog ? prog : bt_regengine.regcomp(expr, re_flags);

        Thanks James, I changed it, works fine now

        Benchmark result using ext-js.vim (507 849 Bytes javascript file)

        Try1:
        Gvim.exe: 11.1533138743
        Gvim-re.exe: 39.4426857432

        Try2:
        Gvim.exe: 10.8661471241
        Gvim-re.exe: 39.3700461863

        Gvim-re is the one using the regexp patch.

        The benchmark script (in Python)

        import os
        from time import clock, sleep

        clock()
        os.system('gvim-re.exe -c "runtime plugin/tohtml.vim" -c "wq!" ext-
        all.js')
        t1 = clock()
        os.system('gvim.exe -c "runtime plugin/tohtml.vim" -c "wq!" ext-
        all.js')
        t2 = clock()

        # This is try2, for try1 I just swap those commands above
        print "Gvim.exe: ", t2-t1
        print "Gvim-re.exe: ", t1

        Try3:
        Gvim.exe: 10.9457255287
        Gvim-re.exe: 39.4854167767

        Try3 is just running gvim.exe -c "wq!" ext-all.js

        ---
        Charles
        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Nico Weber
        ... Have compiled both versions yourself or is gvim.exe the official build? ... How are the results if you just do `gvim[-re].exe -u NONE -U NONE -c wq!`? Nico
        Message 3 of 15 , Apr 4 1:43 AM
        • 0 Attachment
          > Benchmark result using ext-js.vim (507 849 Bytes javascript file)
          >
          > Try1:
          > Gvim.exe: 11.1533138743
          > Gvim-re.exe: 39.4426857432

          Have compiled both versions yourself or is gvim.exe the official build?

          > Try3 is just running gvim.exe -c "wq!" ext-all.js

          How are the results if you just do `gvim[-re].exe -u NONE -U NONE -c
          wq!`?

          Nico

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_dev" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Charles
          ... I compiled both myself. Same settings, same compiler (VC++ 9). Optimization=MAXSPEED (with LTCG), processor=pentium4. Features included: OLE, Python, Mbyte
          Message 4 of 15 , Apr 4 2:13 AM
          • 0 Attachment
            On Fri, Apr 4, 2008 at 3:43 PM, Nico Weber <nicolasweber@...> wrote:
            > Have compiled both versions yourself or is gvim.exe the official build?

            I compiled both myself. Same settings, same compiler (VC++ 9).
            Optimization=MAXSPEED (with LTCG), processor=pentium4. Features
            included: OLE, Python, Mbyte

            > How are the results if you just do `gvim[-re].exe -u NONE -U NONE -c
            > wq!`?

            gvim.exe 0.279026812268
            gvim-re.exe 0.263482935745

            test.py
            ---
            import os
            from time import clock

            clock()
            for i in range(0, 10):
            os.system('gvim.exe -u NONE -U NONE -c q')
            t1 = clock()
            for i in range(0, 10):
            os.system('gvim-re.exe -u NONE -U NONE -c q')
            t2 = clock()

            print "gvim.exe", t1/10
            print "gvim-re.exe", (t2-t1)/10

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_dev" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Charles
            ... Another interpretation of your command sample: Gvim.exe: 0.395710994776 Gvim-re.exe: 0.495461553009 This is just loading the ext-all.js without filetype
            Message 5 of 15 , Apr 4 2:23 AM
            • 0 Attachment
              On Fri, Apr 4, 2008 at 3:43 PM, Nico Weber <nicolasweber@...> wrote:
              > How are the results if you just do `gvim[-re].exe -u NONE -U NONE -c
              > wq!`?

              Another interpretation of your command sample:

              Gvim.exe: 0.395710994776
              Gvim-re.exe: 0.495461553009

              This is just loading the ext-all.js without filetype detection of
              syntax highlighting

              ---
              os.system('gvim.exe -u NONE -U NONE -c "wq!" ext-all.js')
              os.system('gvim-re.exe -u NONE -U NONE -c "wq!" ext-all.js')
              ---

              Gvim.exe: 5.40134745013
              Gvim-re.exe: 19.7571365646

              Loading with syntax highlighting independent of any (g)vimrc settings.

              ---
              os.system('gvim.exe -u NONE -U NONE --cmd "set guioptions+=M" --cmd
              "filetype on" --cmd "syntax on" -c "wq!" ext-all.js')
              os.system('gvim-re.exe -u NONE -U NONE --cmd "set guioptions+=M" --cmd
              "filetype on" --cmd "syntax on" -c "wq!" ext-all.js')
              ---

              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_dev" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Xiaozhou Liu
              ... Thanks for your testing! I will remove gcc extension in the code and check for what makes the new regexp so slow. - Xiaozhou
              Message 6 of 15 , Apr 5 6:13 PM
              • 0 Attachment
                On Fri, Apr 4, 2008 at 5:23 PM, Charles <peacech@...> wrote:
                >
                > On Fri, Apr 4, 2008 at 3:43 PM, Nico Weber <nicolasweber@...> wrote:
                >
                > > How are the results if you just do `gvim[-re].exe -u NONE -U NONE -c
                > > wq!`?
                >
                > Another interpretation of your command sample:
                >
                > Gvim.exe: 0.395710994776
                > Gvim-re.exe: 0.495461553009
                >
                > This is just loading the ext-all.js without filetype detection of
                > syntax highlighting
                >
                > ---
                > os.system('gvim.exe -u NONE -U NONE -c "wq!" ext-all.js')
                > os.system('gvim-re.exe -u NONE -U NONE -c "wq!" ext-all.js')
                > ---
                >
                > Gvim.exe: 5.40134745013
                > Gvim-re.exe: 19.7571365646
                >
                > Loading with syntax highlighting independent of any (g)vimrc settings.
                >
                > ---
                > os.system('gvim.exe -u NONE -U NONE --cmd "set guioptions+=M" --cmd
                > "filetype on" --cmd "syntax on" -c "wq!" ext-all.js')
                > os.system('gvim-re.exe -u NONE -U NONE --cmd "set guioptions+=M" --cmd
                > "filetype on" --cmd "syntax on" -c "wq!" ext-all.js')
                > ---


                Thanks for your testing!
                I will remove gcc extension in the code and check for what
                makes the new regexp so slow.

                - Xiaozhou

                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_dev" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              Your message has been successfully submitted and would be delivered to recipients shortly.