On Thu, Feb 01, 2007 at 11:20:16PM +0300, Alexei Alexandrov wrote:
> Hi Bram et al.,
> 
> I'm doing some performance investigations of Vim code trying to understand 
> whether there are any possibilities to improve it.
> Currently I've made the following observations (all investigations are done 
> on Windows):
> 
> Redundant work is done during regexp operations in syntax highlighting. On 
> some files it is very noticable. The stack of the hotspot is ... > 
> syn_current_attr > syn_regexec > vim_regexec_multi > vim_regexec_both > 
> regtry > regmatch > ga_grow > alloc_clear > memset. So alloc_clear spends 
> quite a few clockticks in lalloc() and memset().
> The reason for this is pessimistically big grow size for regset growing array:
> 
>     ga_init2(&regstack, 1, 10000);
> 
> This is not very good: many regexp operations don't go deep - non-match is 
> detected very quickly. But even one element on the stack will lead to 
> allocating at least 10000 bytes (which should be fast with good CRT memory 
> allocator) and (worse) initializing these 10000 bytes with zeros (won't be 
> that fast).

I am not sure if this is really relevant to vim, because I don't have a
clue which regexp matching algorithm it is using, but you might want to
look into this article, when it comes to regexp speed:

http://swtch.com/~rsc/regexp/regexp1.html

regards,

Martin

Reply via email to