syntime report slow/lags

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

syntime report slow/lags

Ni Va
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

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

syntime.report (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: syntime report slow/lags

Ben Fritz
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: syntime report slow/lags

Ni Va
Hi Ben,

Code is here :

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

2018-01-05 21:07 GMT+01:00 Ben Fritz <[hidden email]>:
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 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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: syntime report slow/lags

Ni Va
Le vendredi 5 janvier 2018 21:59:36 UTC+1, Ni Va a écrit :

> Hi Ben,
>
>
> Code is here :
> https://github.com/octol/vim-cpp-enhanced-highlight/blob/master/after/syntax/cpp.vim
>
>
>
> Thank you for syn-nextgroup even if it is too difficult for ma comprehension.
>
>
> 2018-01-05 21:07 GMT+01:00 Ben Fritz <[hidden email]>:
> 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 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 [hidden email].
>
> 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

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