syntime report slow/lags

42 views
Skip to first unread message

Ni Va

unread,
Dec 21, 2017, 9:41:39 AM12/21/17
to vim_use
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

syntime.report

Ben Fritz

unread,
Jan 5, 2018, 3:07:51 PM1/5/18
to vim_use

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?

Ni Va

unread,
Jan 5, 2018, 3:59:36 PM1/5/18
to vim...@googlegroups.com
Hi Ben,

Code is here :

Thank you for syn-nextgroup even if it is too difficult for ma comprehension.


--
--
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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/BVJbn4kdVxE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ni Va

unread,
Jan 6, 2018, 3:12:53 PM1/6/18
to vim_use
> To unsubscribe from this group and all its topics, send an email to vim_use+u...@googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

Entire patterns in comment :


" syn region cCustomAngleBrackets matchgroup=AngleBracketContents start="\v%(<operator\_s*)@<!%(%(\_i|template\_s*)@<=\<[<=]@!|\<@<!\<[[:space:]<=]@!)" end='>' contains=@cppSTLgroup,cppStructure,cType,cCustomClass,cCustomAngleBrackets,cNumbers
syn region cCustomAngleBrackets matchgroup=AngleBracketContents start="\v%(<operator\_s\{64})@123<!%(%(\_i|template\_s\{64})\zs\<[<=]@!|\<@123<!\<[[:space:]<=]@!)" end='>' contains=@cppSTLgroup,cppStructure,cType,cCustomClass,cCustomAngleBrackets,cNumbers
syn match cCustomBrack "<\|>" contains=cCustomAngleBrackets
" syn match cCustomTemplateFunc "\w\+\s*<.*>(\@=" contains=cCustomBrack,cCustomAngleBrackets
syn match cCustomTemplateFunc "\w\+\s*<.\{-}>(\@=" contains=cCustomBrack,cCustomAngleBrackets
Reply all
Reply to author
Forward
0 new messages