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

Slow PHP file load time due to performance of EnablePHPFolds #24

Open
mmikitka opened this issue Jun 3, 2013 · 0 comments
Open

Slow PHP file load time due to performance of EnablePHPFolds #24

mmikitka opened this issue Jun 3, 2013 · 0 comments

Comments

@mmikitka
Copy link

mmikitka commented Jun 3, 2013

I have been profiling the Vim start-up time of PHP files on my computer, and observed that the EnablePHPFolds function in PIV is a major contributor.

I am loading a 4600-line file, and it takes about 2.5 seconds to complete 4 invocations of EnablePHPFolds (I have not inspected the code to determine why 4 invocations is required). The loaded file is from the Drupal 7.22 release: drupal/includes/form.inc.

To access the file:

  1. Download at https://drupal.org/download
  2. Unpack tgz
  3. Access drupal/includes/form.inc

Here are the relevant computer specs:

OS: Ubuntu 12.04
Hardware: Core i7, 8GB RAM
PHP indent: /usr/share/vim/vim73/indent/php.vim
Loaded file:

I ran the following command to generate the profile data

vim --cmd 'profile start profile.log' --cmd 'profile func *' --cmd 'profile file home/mmikitka/.vim/bundle/PIV/*' -c 'profdel func *' -c 'profdel file *' -c 'qa!' form.inc

Here is the profile output:

FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
4 3.392811 0.000026 91_EnableFastPHPFolds()
4 3.392785 2.515609 91_EnablePHPFolds()
3 2.349923 0.006236 23_LoadFTPlugin()
1 1.091110 0.000003 InitDrupalFile()
1 1.057983 0.000008 91_CheckAutocmdEnablePHPFold()
8 0.877176 0.000440 91_PHPCustomFolds()
16 0.829981 0.026336 91_PHPFoldPureBlock()
968 0.426004 91_FindPureBlockEnd()
1 0.261470 0.000043 6_FTinc()
1000 0.179377 91_FindOptionalPHPDocComment()
984 0.173407 91_FindPureBlockStart()
3 0.093296 0.004204 4_SynSet()
1 0.069849 0.000190 GitGutter()
64 0.042520 0.001242 vundle#config#bundle()
88 0.040567 91_FindPatternStart()
40 0.034428 0.002700 91_PHPFoldProperties()
1 0.032176 0.000041 65_is_active()
1000 0.027254 91_HandleFold()
1 0.026152 0.000096 65_init()
1 0.025809 0.000057 65_define_signs()

FUNCTIONS SORTED ON SELF TIME
count total (s) self (s) function
4 3.392785 2.515609 91_EnablePHPFolds()
968 0.426004 91_FindPureBlockEnd()
1000 0.179377 91_FindOptionalPHPDocComment()
984 0.173407 91_FindPureBlockStart()
88 0.040567 91_FindPatternStart()
1000 0.027254 91_HandleFold()
16 0.829981 0.026336 91_PHPFoldPureBlock()
1 0.025703 65_define_sign_line_highlights()
1 0.024453 0.021004 59_Highlights()
64 0.017420 10_rtp_add_a()
66 0.016938 10_rtp_rm_a()
3 2.349923 0.006236 23_LoadFTPlugin()
50 0.006221 0.006001 67()
3 0.093296 0.004204 4_SynSet()
64 0.003139 10_parse_name()
40 0.034428 0.002700 91_PHPFoldProperties()
64 0.007060 0.002390 vundle#config#init_bundle()
18 0.001947 81_CreateMaps()
2 0.001835 0.001797 ctrlp#utils#writecache()
8 0.001648 PHPFoldText()

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

1 participant