Friday, January 5, 2018

Re: syntime report slow/lags

On Thursday, December 21, 2017 at 8:41:39 AM UTC-6, Ni Va wrote:
> Hi,
>
> Here is a syntime report that show slow regexp
>
> TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN
> 0.703272 897 78 0.007309 0.000784 cCustomAngleBrackets \v%(<operator\_s*)@<!%(%(\_i|template\_s*)@<=\<[<=]@!|\<@<!\<[[:space:]<=]@!)
> 0.089086 827 0 0.049759 0.000108 cppRawString \%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(
> 0.053747 898 71 0.000639 0.000060 cCustomFunc \w\+\s*(\@=
>
>
>
> How can I fix the first and second one ?
> Thank you

For the first, it uses a couple lookbehind assertions with unlimited distance which can be very slow. If you can limit the distance to look back, you can make it much faster (see the help just under ":help /\@<!", for "\@123<!").

Unfortunately if you really need an unbounded amount of whitespace/newlines in your lookbehind, this may not be an option for you. You can experiment with breaking up the pattern and using nextgroup (:help :syn-nextgroup) but no guarantees there.

I'm not sure what would make the second item slow from what you've posted. Is that the complete pattern?

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: