Hi

Consider those 3 commands using the new regexp engine
which only differ by the length of the line being
matched:

$ vim -u NONE -c'set re=0 hls' -c'norm aaaa'   -c'/\(\)\(a*\1*\1*\1*\)*$' -c'q!'
$ vim -u NONE -c'set re=0 hls' -c'norm aaaaa'  -c'/\(\)\(a*\1*\1*\1*\)*$' -c'q!'
$ vim -u NONE -c'set re=0 hls' -c'norm aaaaaa' -c'/\(\)\(a*\1*\1*\1*\)*$' -c'q!'

Matching becomes very slow as the line length increases.
Above 3 commands with vim-8.0.134 take respectively:

   0.8sec
   3.9sec
 356.4sec (at half time, it shows "search hit BOTTOM, continuing at TOP")

The same commands with 'set re=1' instead of 'set re=0' are almost
instantaneous (0.017 sec).

Timing with the new regexp engine grows significantly as we add only
1 char to the line being matched. I thought that the complexity of new
regexp engine was linear with the length of the line being matched,
but that's clearly not the case here.

Not only it's slow, but:
- CTRL-C does not interrupt the search
- and the amount of memory that Vim uses keeps increasing during the
  first half of the time i.e. until it shows
  "search hit BOTTOM, continuing at TOP".

Can't vim simplify the regexp here? i.e. when something like x*x*x*
should be equivalent to x* if x is an atom.  So the part  \1*\1\*\1*
should be equivalent to  \1*  and in that case, the following
line is much quicker (0.21 sec):

$ vim -u NONE -c'set re=0 hls' -c'norm aaaaaa' -c'/\(\)\(a*\1*\)*$' -c'q!'

Regards
Dominique

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui