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

48103Re: Vim 7 performance notes

Expand Messages
  • Bram Moolenaar
    Oct 3, 2007
    • 0 Attachment
      Alexei Alexandrov wrote:

      > > Instead of doubling each time, which is going to be big chunks quickly,
      > > another way would be to first allocate one block at the start size of
      > > about 1000 bytes, then set the growsize to 10000. So we grow at the
      > > same speed as before. Then no extra field or function is needed, it's
      > > local change in the regexp code.
      > >
      > > Something like:
      > > if (regstack.ga_data == NULL)
      > > {
      > > ga_init2(®stack, 1, 1000);
      > > ga_grow(®stack, 1);
      > > }
      > > regstack.ga_growsize = 10000;
      > >
      > > I do wonder if the memory needs to be cleared when re-using the
      > > allocated memory. Can you check that?
      > >
      > I'd like to get back to this topic - after I use my patch for half a
      > year without a problem.
      > The patch is attached. It addresses your comments fully. Please take a look.
      > Regarding cleaning the stacks - from what I can tell from the code, it's
      > not needed. regmatch() clears the stack heads in the beginning by
      > resetting the len of arrays, and then it uses only the part of the stack
      > it fills.
      > In fact, I also considered moving the stack allocation management
      > directly to regmatch() since the stacks are actually used only there.
      > But it's more cosmetic change and shouldn't affect the functionality in
      > any way (though we may get 2 reallocations per regexec_both call in case
      > of big chunks).
      > So does the patch look like a good one to you? Or will I just live with
      > it here locally? :)

      The patch looks OK to me. The big question is: how much performance do
      we gain?

      There is also another regexp improvement underway, this was part of the
      Google summer of code. It would be nice if we have a performance
      measurement mechanism, so that the regexp stuff can be tuned. A Vim
      script would be best, so that it can be run everywhere. Perhaps using
      some of the syntax highlighting, since that uses regexp a lot and
      provides a real-world situation. Since the actual display updating is
      not what we want to measure, using the synID() function might work.
      Combined with ":syn sync fromstart".

      ARTHUR: Now stand aside worthy adversary.
      BLACK KNIGHT: (Glancing at his shoulder) 'Tis but a scratch.
      ARTHUR: A scratch? Your arm's off.
      "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ download, build and distribute -- http://www.A-A-P.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 30 messages in this topic