Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Syntastic is killing my vim :-( #542

Closed

Description

@noose

Hi,
I use Vundler with that config:

Bundle 'Syntastic'
let g:syntastic_check_on_open=1
let g:syntastic_enable_signs=1
let g:syntastic_auto_jump=1
let g:syntastic_php_checkers=['php']
let g:syntastic_json_checkers=['jsonlint', 'jsonval']
let g:syntastic_twig_checkers=['twiglint']
let g:syntastic_auto_loc_list=1
let g:syntastic_enable_highlighting=1
let g:syntastic_echo_current_error=1

When I'm openning php file with 1k++ line syntastic is killing my vim (quad core machine - vim is using 110% cpu) 👎
Even with minimal syntastic config ..

 Bundle 'Syntastic'
 let g:syntastic_check_on_open=1

When I'll comment out synstastic everythink is ok.
What can I do with that?
Regards,
Pawel

Vim version:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Feb 21 2013 13:27:45)
Included patches: 1-547
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by jamessan@debian.org
Huge version without GUI.  Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent -clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic +emacs_tags +eval
+ex_extra +extra_search +farsi +file_in_path +find_in_path +float +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
 +mouse_dec +mouse_gpm -mouse_jsbterm +mouse_netterm -mouse_sysmouse +mouse_xterm +mouse_urxvt +multi_byte +multi_lang -mzscheme +netbeans_intg +path_extra -perl +persistent_undo +postscript +printer +profile -python -python3 +quickfix +reltime +rightleft -ruby
+scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace
+wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -Wall -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -Wl,--as-needed -o vim       -lm -lncurses -lnsl  -lselinux -lacl -lattr -lgpm

Activity

  1. lcd047 commented on Mar 5, 2013

    @lcd047
    Collaborator
    1. What happens if you leave out g:syntastic_check_on_open and start syntastic by running :SyntasticCheck manually? That is, does the load increase from the moment you start Vim, or only after you run :SyntasticCheck.
    2. You appear to be running Linux with the SELinux patch. Have you tried disabling SELinux?
  2. noose commented on Mar 5, 2013

    @noose
    Author
    1. Yes - load is when SyntasticCheck is starting
    2. I can't disable SELinux (i'm only user, without sudo or su password).
  3. lcd047 commented on Mar 5, 2013

    @lcd047
    Collaborator

    SELinux changes the semantic of the system calls. Try running this in Vim while syntastic is inactive: :echo executable("php"). Does it happen to trigger the increased load?

  4. noose commented on Mar 5, 2013

    @noose
    Author

    :echo executable("php")

    Everything is working just fine...

  5. lcd047 commented on Mar 5, 2013

    @lcd047
    Collaborator

    Any change if you run the test for a name that doesn't exist, f.i. :echo executable("some_dummy_name")?

    As far as I can tell this is far more likely to be related to SELinux than to syntastic itself, but it's hard to be sure without root access. Perhaps ask you sysadmin to look at SELinux logs?

  6. noose commented on Mar 5, 2013

    @noose
    Author

    Ok, I'll try to get logs from SELinux.

    btw, :echo executable("some_dummy_name")
    it's working fine... :-(

  7. noose commented on Mar 5, 2013

    @noose
    Author

    One more info.
    Now I have tryied to open 230 lines php file. There are some problems with that file (php code sniffer shows 350 errors, 10 warningns, etc). Maybe showing that is a problem?

  8. lcd047 commented on Mar 5, 2013

    @lcd047
    Collaborator

    Well, syntastic runs some checkers against your files using the makeprg mechanism, then tries to parse the results with errorformat, and shows them nicely in a window. Some of the checkers rely on helper scripts to re-format the results, but they don't try to do anything clever beyond that. If your code sniffer runs slowly by itself, for whatever reasons, or if something like SELinux prevents some normal initialization steps, that isn't really syntastic's fault.

  9. noose commented on Mar 5, 2013

    @noose
    Author

    Checkers are very fast. Only drawing windows (buffers?) in vim is pain in the ... :-(
    From my admin: "There is nothing in the SELinux logs". :-(

  10. lcd047 commented on Mar 5, 2013

    @lcd047
    Collaborator

    Ok, here's a quick profiling hack. Please add this patch: cd48979, run syntastic, then run :messages. This should produce a time trace, more or less like this:

    UpdateErrors(1):   0.000269
    CreateAndRegisterChecker(php):   0.000113
    CreateAndRegisterChecker(phpcs):   0.000134
    CreateAndRegisterChecker(phpmd):   0.000133
    SyntasticChecker.getLocList:   0.062045
    SyntasticChecker.getLocList:   0.425235
    UpdateErrors(0):   1.935665
    Redraw:   0.084012
    
  11. noose commented on Mar 6, 2013

    @noose
    Author
    "Api.php" 1612L, 45902C
    CreateAndRegisterChecker(php):   0.000346
    CreateAndRegisterChecker(phpcs):   0.000369
    CreateAndRegisterChecker(phpmd):   0.000345
    SyntasticChecker.getLocList:   0.064030
    SyntasticChecker.getLocList:   1.608596
    UpdateErrors(0):   6.953987
    Redraw:   0.285746
    

    Thanks

  12. lcd047 commented on Mar 6, 2013

    @lcd047
    Collaborator

    Ok, now please apply 18a64ce and re-run the test.

  13. noose commented on Mar 6, 2013

    @noose
    Author
    "Api.php" 1612L, 45902C
    CreateAndRegisterChecker(php):   0.000327
    CreateAndRegisterChecker(phpcs):   0.000345
    CreateAndRegisterChecker(phpmd):   0.000341
    CacheErrors - active checkers for php:   0.003909
    php.getLocList:   0.063754
    phpcs.getLocList:   1.574731
    CacheErrors - extend for php:   1.670170
    CacheErrors:   1.674559
    RefreshSigns:   4.847997
    HighlightErrors:   0.363400
    ll:   0.000078
    UpdateErrors(0):   6.974516
    Redraw:   0.600443
    

    This is problem with SELinux?

  14. lcd047 commented on Mar 6, 2013

    @lcd047
    Collaborator

    Now, 4.8 seconds in RefreshSigns() is beyond bizarre. Please apply 6833177 and re-run the test.

  15. noose commented on Mar 6, 2013

    @noose
    Author
    "Api.php" 1612L, 45902C
    php.getLocList:   0.063775
    phpcs.getLocList:   1.563130
    CacheErrors:   1.661983
    * old_signs[0]
    loclist[11]
    first_sign_id = 5000
    SignErrors:   4.754626
    RemoveSigns:   0.000039
    RefreshSigns:   4.755168
    HighlightErrors:   0.368122
    UpdateErrors(0):   6.873432
    Redraw:   0.286704
    
  16. 11 remaining items

  17. lcd047 commented on Mar 7, 2013

    @lcd047
    Collaborator

    Right, that rules out the patch level and SELinux. Sadly, I've also run out of potentially relevant ideas.

    Well, I suppose you could still compile a version of Vim with profiling information, run it through strace / ltrace / truss / ktrace / whatever, look at kernel debugging logs, and all the related fun, but that doesn't seem like a good use of your time. :) Or perhaps post to the Vim list.

    For what it's worth, I've never seen Vim at 100% CPU for more than a few fractions of a second at a time, and I have been using it for maybe 18 years, on all forms and shapes of UNIX incarnations, including Linux. shrug

  18. harleypig commented on Mar 7, 2013

    @harleypig

    A little late to the party ... try setting aside your current ~/.vim and ~/.vimrc and installing just the syntastic plugin in an otherwise empty configuration?

  19. noose commented on Mar 8, 2013

    @noose
    Author
    php.getLocList:   0.063449
    phpcs.getLocList:   1.586305
    CacheErrors:   1.681002
    * old_signs[0]
    loclist[2556]
    * caching 2517:   0.096820
    SignErrors loop:   4.350013
    SignErrors:   4.540396
    RemoveSigns:   0.000038
    RefreshSigns:   4.540828
    HighlightErrors:   0.330138
    * caching 2517:   0.000086
    * caching 2517:   0.000063
    UpdateErrors(0):   6.566397
    Redraw:   0.145302
    

    .vimrc

    set nocompatible               " be iMproved
    filetype plugin on
    " czesc configu zassana z https://github.com/spf13/spf13-vim/blob/3.0/.vimrc
    
    scriptencoding utf-8
    
    set number " numery linii
    syntax on
    set rtp+=~/.vim/bundle/vundle/
    call vundle#rc()
    
    " let Vundle manage Vundle
    "  " required!
    Bundle 'gmarik/vundle'
    
    Bundle 'twilight256.vim'
    colorscheme twilight256 " kolorki
    
    Bundle 'Syntastic'
    " let g:syntastic_check_on_open=1
    let g:syntastic_enable_signs=1
    let g:syntastic_auto_jump=1
    let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd']
    let g:syntastic_json_checkers=['jsonlint', 'jsonval']
    let g:syntastic_twig_checkers=['twiglint']
    let g:syntastic_auto_loc_list=1
    let g:syntastic_enable_highlighting=1
    let g:syntastic_echo_current_error=1
    

    :-(

  20. harleypig commented on Mar 8, 2013

    @harleypig

    Well, I meant everything, including Vundle, but I don't see how Vundle would be contributing to this. I have no more ideas to suggest. Sorry.

  21. scfarley commented on Mar 21, 2013

    @scfarley

    I have run into the issue with Vim taking a long to handle a file with a lot of errors. I use the following workarounds. It has been awhile since I looked into the problems, but I wrote down notes that may help. Of course, my notes may be wrong.

    " Disable slow scanning of buffer.
    " TODO: look if Syntastic is calling RefreshSigns for every error during a
    " scan.
    let g:syntastic_enable_signs=0

    " Disable slow cursor movement.
    " TODO: see if better autocmd than cursormoved or something with a delay
    " because it is slow if there are a lot of errors.
    let g:syntastic_echo_current_error=0

    For this last one, I was thinking that the current error does not need to be updated for each line as I scroll quickly up or down the file. Maybe, the echo can be done when I release the cursor?

    An example of a file that is slow to process:
    https://github.com/rastersoft/Devede/blob/master/devede_video_convert.py

  22. lcd047 commented on Apr 13, 2013

    @lcd047
    Collaborator

    The slow cursor movement is addressed in 0deeefd.

  23. noose commented on Apr 15, 2013

    @noose
    Author

    It is much better;-) Thanks! 👍

  24. jstasiak commented on Jun 11, 2013

    @jstasiak

    I'm just gonna leave it here: 0deeefd is still slow for me, I had to enable lazyredraw in Vim to make it usable again (600 lines of code file, ~170 warnings/errors/etc.), I suggest giving it a try.

    cc #463

  25. lcd047 commented on Jun 11, 2013

    @lcd047
    Collaborator

    There is little reason not to have lazyredraw set, that should be the default. Other common causes of slow scrolling are cursorcolumn and cursorline (via slow syntax highlighting patterns). You probably want them unset: set nocuc nocul.

    That said, commit 0deeefd is already old, you should update to the current master HEAD and try again. If you still have problems please open a new issue, with a more explicit description.

  26. jstasiak commented on Jun 11, 2013

    @jstasiak

    I'm using 6574872, should've probably said so. As I said, enabling lazyrender seems to make it usable for me so I'm just leaving this note here with hope it helps someone.

  27. scfarley commented on Jun 11, 2013

    @scfarley

    As I noted in #655 (comment), scrolling is fast if the cursor is in the first column but slow in the last column of the line even with lazyredraw, nocuc and nocul set.

    Something must be working awfully hard depending upon the column position.

  28. lcd047 commented on Jun 12, 2013

    @lcd047
    Collaborator

    @scfarley: That something is probably syntax highlighting, not syntastic. Ok, I'll add a note about profiling, so that you guys can see for yourselves what's going on.

  29. jc00ke commented on Apr 6, 2015

    @jc00ke

    As @scfarley pointed out, let g:syntastic_enable_signs=0 could be a viable solution. I just ran in to this issue, (100% CPU load, several seconds locked up) and that config setting improved performance to a usable level.

  30. lcd047 commented on Apr 7, 2015

    @lcd047
    Collaborator

    @jc00ke: Your problem is likely to be unrelated to the above. Please enable profiling cf. #688, and open a new issue. Please describe what you did, and add details about your config, your OS, your version of Vim, your version of syntastic, and the profiling logs.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions