Alexei Alexandrov wrote:

> >
> > The idea to gradually increase the chunk size makes sense, but not
> > everywhere.  For the syntax stack it's probably better to start with a
> > stack that is mostly needed, then growing quite quickly (say double the
> > chunk size every time).  That's because when recursive things are
> > involved we need much more space.  And copying the stack to another
> > place is more expensive than clearing with zeroes.
> >
> > Perhaps you can do some investigation about what the size mostly ends up
> > to be.  Then use that with a special version of ga_grow() that increases
> > the chunk size every time.
> 
> I've also tried the approach with persisting the regstack and backpos
> allocation across calls to vim_regexec_both. It seems to work even
> better than increasing the grow size in my particular test cases. And
> I can't think up any situation when it can slow things down. Could you
> please take a look at the patch attached and provide your opinion?

Speed should be OK this way, but it does keep up to 32 Kbyte allocated.
That may not seem much, but if we do this in many places it quickly adds
up.

Can you show the benchmarks you used to see the performance and the
stack space that is being used?  Otherwise we keep guessing the best
numbers.

Coding detail: please don't use "if (!number)", use "if (number == 0)",
that is so much easier to read.  Checking if ga_data is NULL would be
simpler.

-- 
>From "know your smileys":
 :q     vi user saying, "How do I get out of this damn emacs editor?"

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- 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    ///

Reply via email to