Loading ...
Sorry, an error occurred while loading the content.

vim getting slower and slower loading multiple files

Expand Messages
  • Matteo Cavalleri
    sometimes vim takes a lot of time to load a file, and the more file i load, the more time it takes (i m talking about even 20 seconds or more). i ve been able
    Message 1 of 4 , May 21, 2013
    • 0 Attachment
      sometimes vim takes a lot of time to load a file, and the more file i load, the more time it takes (i'm talking about even 20 seconds or more).

      i've been able to reproduce the problem by just loading 10 identical files one after the other. it seems a problem with my configuration, as using "vim -u NONE -U NONE" doesn't show any significant slow down, so i recompiled vim with the huge feature set and i tried some profiling.
      I'm new to this vim functionality, but if i didn't make any mistake here's what i discovered so far:

      FUNCTIONS SORTED ON TOTAL TIME
      count total (s) self (s) function
      1031 33.785843 2.328670 <SNR>15_SynSet()
      1031 1.240259 1.058717 <SNR>11_LoadFTPlugin()
      [etc]

      FUNCTIONS SORTED ON SELF TIME
      count total (s) self (s) function
      1031 33.785843 2.328670 <SNR>15_SynSet()
      1031 1.240259 1.058717 <SNR>11_LoadFTPlugin()
      [etc]

      the function is this one:

      FUNCTION <SNR>15_SynSet()
      Called 1031 times
      Total time: 33.785843
      Self time: 2.328670

      count total (s) self (s)
      [...]
      2062 0.020603 for name in split(s, '\.')
      1031 31.834159 0.376986 exe "runtime! syntax/" . name . ".vim syntax/" . name . "/*.vim"
      1031 0.001621 endfor
      [etc]

      so i suppose the culprit is this line of code, which load the syntax plugins for the file i just loaded. i have no idea why it takes more and more time each time i load a new file, but the problem is: i have no idea what to do now :(

      any suggestions? thanks in advance

      --
      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Matteo Cavalleri
      i ve tried to do some experimentations... here s what i found. If i run vim and give the command ... the first time i load a file i get foo1.tpl 36L, 1231C
      Message 2 of 4 , May 21, 2013
      • 0 Attachment
        i've tried to do some experimentations... here's what i found. If i run vim and give the command


        :au Syntax * echo expand("<amatch>")


        the first time i load a file i get


        "foo1.tpl" 36L, 1231C
        smarty
        Press ENTER or type command to continue


        then i load another file and get


        "foo2.tpl" 36L, 1231C
        smarty
        smarty
        smarty
        Press ENTER or type command to continue


        and so on. any time a load another smarty file, the list of "smarty" gets longer. btw i'm not sure if what i see is the old output plus the new one or just the current value of "expand()".

        so i'm one step closer to the cause of the problem, but i again have no clue how to proceed, because as far as i know the value of "<amatch>" is set only in fileio.c



        --
        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Marc Weber
        retry with syn off or filetype off. Do your problems still occur? Excerpts from Matteo Cavalle foo2.tpl 36L, 1231C ... YOu may want to start vim
        Message 3 of 4 , May 21, 2013
        • 0 Attachment
          retry with syn off or filetype off.
          Do your problems still occur?

          Excerpts from Matteo Cavalle> "foo2.tpl" 36L, 1231C
          > smarty
          > smarty
          > smarty
          > Press ENTER or type command to continue
          YOu may want to start vim -V20/tmp/log

          then have a look for echo echom echoe lines outputting smarty.

          It looks like each time the same code gets executed once more.

          This happens eg if you reload files without clearing au commands:

          au FOO
          au!
          au BufNewFile * do stuff
          augroup end

          if you forgett the au! it may happen that a new entry triggering do
          stuff is executed for each file.

          Eg use "tail -f /tmp/log > /tmp/new-lines", open a file, stop by
          ctrl-c. Repeat piping into new-lines2, then use diff or uniq -c or such
          to find out which code gets executed more and more times?

          I hope those hints are useful to you.

          Regards
          Marc Weber

          --
          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Matteo Cavalleri
          ... with syntax off the problem seems to be drastically reduced, but not disappeared completely. however i verified this just with my eyes, no profiling at
          Message 4 of 4 , May 21, 2013
          • 0 Attachment
            > retry with syn off or filetype off.

            with syntax off the problem seems to be drastically reduced, but not disappeared completely. however i verified this just with my eyes, no profiling at all. i just see a small delay loading the last file while the first few where loaded instantly. anyway, i can say such a small delay equals to no problem at all.

            with filetype off the problem is gone. still verified without profiling but i see no delay loading the last file.


            > YOu may want to start vim -V20/tmp/log
            > then have a look for echo echom echoe lines outputting smarty.

            mh... i was outputting "smarty" with an autocmd i used to see the value of <amatch> (which is used by the function that loads the filetype scripts). but maybe i haven't understood your advice.


            > if you forgett the au! it may happen that a new entry triggering do
            > stuff is executed for each file.

            so each time i load a file, some script add another copy of "do stuff" to the list of autocommands? i'll try to check (and maybe temporary remove) my autocmds in vimrc. if that doesn't solve the problem i'll try deleting plugins one at a time. i'll also try the other suggestion with tail. i don't have time to do them right now, so i'll be back as soon as i have time to test them all :)

            thanks for your help


            --
            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php

            ---
            You received this message because you are subscribed to the Google Groups "vim_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          Your message has been successfully submitted and would be delivered to recipients shortly.