StanAngeloff / php.vim

An up-to-date Vim syntax for PHP (7.x supported)
477 stars 69 forks source link

Performance issues in a file with single comment #66

Closed stormherz closed 6 years ago

stormherz commented 7 years ago

I was having heavy performance issues and overall slowness in my php files so I've excluded plugins one by one to pinpoint the cause of it. After disabling php.vim everything came back to normal.

Here is a sample file, which is very slow in opening and moving around on my machine with plugin enabled:

<?php

// jjjjjjjjjjjjjjjjjjjjjjjjjjfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdfffffffffffffffffffffffffffffffffffffffffffff

My envirnoment: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan 12 2017 03:04:35) MacOS X 10.12.2 (16C67) Included patches: 1-172

Let me know if you need profiling logs or anything like that =)

StanAngeloff commented 7 years ago

Confirmed, I get this as well. After disabling everything in the highlighting code I could think of, Vim is still slow to work in a file containing a long line.

I tried pasting the same line in a .js file and that yielded abysmal editing speeds, too.

It seems like Vim is just too slow with very long lines.

Can you confirm if you are experiencing similar issues editing long lines using a different syntax, e.g., XML?

stormherz commented 7 years ago

Hm, tried with js and xml - vim is getting slower, yes, but not that much, the usual slowness =) I don't think there is a underlying bug indeed in php.vim, because, yeah, we all now how vim terribly handles long lines when highlighting is involved, just thought to let you know that with enabled php.vim editor is getting slower in php files, but that can be subjective, I guess. And it's just a bad practice to have such long lines in code anyway =)

Techwolf12 commented 7 years ago

I've tested it with other syntax plugins but none of those slows vim down as much as this plugin does. I do believe there is a lot to be optimized in this plugin.

StanAngeloff commented 7 years ago

@Techwolf12 I agree.

StanAngeloff commented 6 years ago

The culprit seems to be #68 phpHereDoc regexp. If you set this in vimrc, editing becomes fast again:

let php_html_load=0
let php_html_in_heredoc=0
let php_html_in_nowdoc=0

let php_sql_query=0
let php_sql_heredoc=0
let php_sql_nowdoc=0

Use #68 to continue the discussion.