Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cause long php files to be slow. #109

Open
cmtatro opened this issue Apr 12, 2018 · 5 comments
Open

Cause long php files to be slow. #109

cmtatro opened this issue Apr 12, 2018 · 5 comments

Comments

@cmtatro
Copy link

cmtatro commented Apr 12, 2018

Forcing the hereDoc and nowDoc to syntax highlight if people don't want to use them is a little rough, considering it causes slowdowns on larger files.

After running syntime on a thousand line php file; the slow down, for these three ( javascript, sql, html ) to run, was around .24 seconds each per render. That is a whole second between key strokes.

https://github.com/shawncplus/phpcomplete.vim/blob/master/syntax/phpcompletetempbuffer.vim#L28-L39

@complex857
Copy link
Collaborator

Thank you for tracking this one down. I've tried to run the tests without them and things seem to pass. The only thing we used those to skip comments when we are looking for beginnings and ends of functions/classes but the normal comment area patterns would cover those, so I'd say it should be safe to merge.

Would you mind giving this issue-109 branch a try for a few days to see if i'm missing something?

@cmtatro
Copy link
Author

cmtatro commented Apr 13, 2018

I checked out your branch with the items commented out, but no luck. I did see some speed improvement, but not the amount I was looking for. On a hunt to find out where else that regex is being called from

@cmtatro
Copy link
Author

cmtatro commented Apr 13, 2018

So I found a workaround to my issue.
I am just going to clear the syn rule that is causing the issue.

:syn clear phpHereDoc

Thank you for trying to resolve the slow down.

@complex857
Copy link
Collaborator

Hmm, wait- now I'm confused 😊

The syntax file in this plugin is only used for hidden buffers the plugin uses to parse source code (mainly to find a function's opening / closing { } pairs and to see if things are in comments and/or strings) and in general should only be a slow-down on typing when you either:

  1. Start the completion (triggering with ctrl+xo or so)
  2. When you have had some base of completion and you are deleting backwards of that (re-triggers the whole search with a new shorter base).

The file you are actually editing shouldn't be affected by the syntax file in the repo, but the usual php syntax file you get with vim (or a third party) - correct me if I'm wrong here.
The file type the plugin has a syntax for is named phpcompletetempbuffer in hopes it won't collide with anything. If you check the value b:current_syntax and you see anything else then it shouldn't be related.

@cmtatro
Copy link
Author

cmtatro commented Apr 14, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants