Skip to content

Cause long php files to be slow. #109

Open
@cmtatro

Description

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

Activity

complex857

complex857 commented on Apr 13, 2018

@complex857
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

cmtatro commented on Apr 13, 2018

@cmtatro
Author

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

cmtatro commented on Apr 13, 2018

@cmtatro
Author

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

complex857 commented on Apr 14, 2018

@complex857
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

cmtatro commented on Apr 14, 2018

@cmtatro
Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Cause long php files to be slow. · Issue #109 · shawncplus/phpcomplete.vim