swekaj / php-foldexpr.vim

Vim folding for PHP with foldexpr
MIT License
41 stars 10 forks source link

Performance problem on indenting in large file #15

Open askobara opened 10 years ago

askobara commented 10 years ago

Profile info

FUNCTIONS SORTED ON TOTAL TIME
count  total (s)   self (s)  function
186694 132.447726  45.251909  GetPhpFold()
166864  87.179004             FindPrevClassFunc()
   13   4.674672   0.002486  <SNR>86_UpdateErrors()
   13   3.091846   0.008128  <SNR>86_CacheErrors()
FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
166864             87.179004  FindPrevClassFunc()
186694 132.447726  45.251909  GetPhpFold()
   13   0.777582   0.767910  98()
   13   0.693651   0.685620  99()
swekaj commented 9 years ago

What do you use to profile? I've never profiled vim before. Also, do you have a sample large file you can provide? Most of my scripts lately aren't more than a few dozen lines.

A temporary solution would be to turn off the option for folding class extends//implements lists and function argument lists with b:phpfold_group_args = 0. That should eliminate any calls to FindPrevClassFunc(), which seems to be a significant portion..

askobara commented 9 years ago

Your solution works! Thanks!

For profile I use basic commands:

:profile start profile.log
:profile func *
:profile file *
" At this point do slow actions
:profile pause
:noautocmd qall!

File on which I have performance problem is simple Yii config: nested arrays, 400+ lines, a lot of them are strings. Nothing special. If indenting by pieces the difference is not noticeable.

sudar commented 8 years ago

I also ran into a performance issue recently and was using the above commands to profile and I found that the FindPrevClassFunc and GetPhpFold functions were called for insane amount of time.

The PHP file that I am using is only about 250 lines but it has lot of table markup in HTML. I will be happy to provide the PHP file if it can aid in debugging the performance issue.