Hi Frederic! On Mi, 26 Mai 2010, Frederic Hardy wrote:
> Since patch 274, my vim/gvim is very slow, specialy when i'm editing a > large php file with my custom syntax file. > > All my vim files (.vimrc, .gvimrc, .vim) are available here : > http://medias.mageekbox.net/vim.tgz. > > There is a large php file in the tar archive to illustrate my problem. > Use my config files and try to modify the class name or remove the > "abstract" keyword at line 8 to see the problem (perhaps...). > Then i do it, my CPU usage grown to 100% and vim is frozen until i do > not hit <ctrl-c>. > > I have the problem under FreeBSD 7.1 and FreeBSD 8. > > This is the result of the :version command in vim : > > VIM - Vi IMproved 7.2 (2008 Aug 9, compiled May 26 2010 12:01:44) > Included patches: 1-6, 8-35, 37-48, 50-70, 73, 75-87, 90-92, 94-100, > 102-137, 139-149, 151-171, 173-190, 192-193, 195-203, 206-211, 213-215, > 217-218, 220-232, 234-246, 251-259, 261-3 > 01, 303-319, 321-322, 324-335, 337-351, 353-361, 363, 366-371, 373, > 375-376, 378-383, 385-387, 389-398, 401-402, 404-411 > Compiled by f...@witchblade > Big version with GTK2 GUI. Features included (+) or not (-): > +arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset > +cindent +clientserver +clipboard +cmdline_compl +cmdline_hist > +cmdline_info +comments +cryptv +cscope > +cursorshape +dialog_con_gui +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 +menu +mksession > +modify_fname +mouse +mouseshape +mouse_dec > -mouse_gpm -mouse_jsbterm +mouse_netterm +mouse_sysmouse +mouse_xterm > +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra > -perl +postscript +printer -profile > +python +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_interact +xterm_clipboard -xterm_save > system vimrc file: "$VIM/vimrc" > user vimrc file: "$HOME/.vimrc" > user exrc file: "$HOME/.exrc" > system gvimrc file: "$VIM/gvimrc" > user gvimrc file: "$HOME/.gvimrc" > system menu file: "$VIMRUNTIME/menu.vim" > fall-back for $VIM: "/usr/local/share/vim" > Compilation: cc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK > -D_THREAD_SAFE -D_REENTRANT -I/usr/local/include/gtk-2.0 > -I/usr/local/lib/gtk-2.0/include -I/usr/local/include/atk-1.0 > -I/usr/local/include/cairo -I/usr/local/include/pango-1.0 > -I/usr/local/include/gio-unix-2.0/ -I/usr/local/include > -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/u > sr/local/include/pixman-1 -I/usr/local/include/freetype2 > -I/usr/local/include -O2 -pipe -march=pentium-m -fno-strict-aliasing > -march=pentium-m -D_FORTIFY_SOURCE=1 -I/usr/local/incl > ude -I/usr/local/include/python2.6 -D_THREAD_SAFE > -I/usr/local/lib/ruby/1.8/i386-freebsd8 -DRUBY_VERSION=18 > Linking: cc -L/usr/local/lib -L/usr/local/lib -R/usr/local/lib -L. > -rpath=/usr/lib:/usr/local/lib -pthread -rdynamic -L/usr/local/lib -o > vim -pthread -L/usr/local/lib -lgtk-x11-2 > .0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lXext > -lXrender -lXinerama -lXi -lXrandr -lXcursor -lXcomposite -lXdamage > -lpangoft2-1.0 -lgio-2.0 -lXfixes -lcairo -lpa > ngo-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 > -lgthread-2.0 -lglib-2.0 -lXt -pthread -ltermlib > -L/usr/local/lib/python2.6/config -lpython2.6 -lutil -Wl,--export-dynamic > -Wl,-R -Wl,/usr/local/lib -L/usr/local/lib -lruby18 -lrt -lm > -L/usr/lib -rpath=/usr/lib:/usr/local/lib -pthread > > I known that the patch 274 is ok and that vim is slow with syntax > folding, but it's very annoying and i want to be sure that the problem > is not in my config files or in my plug-in (but i have the problem with > gvim -U NONE -u NONE with no .vim directory in my home). > > vim was compiled from FreeBSD port /editors/vim. I can reproduce it with your provided syntax file and my debian vim 7.2.330. I haven't looked into the syntax file in detail, but it seems to be the problem. Using your syntax php file and layout.php that you provided[1], this simple_vimrc script shows the problem: ,---- | profile start my_profile_php | fun Profile() | syntax on | e layer.php | set fdm=syntax | "call feedkeys(":set synmaxcol=100\n", 't') | call feedkeys(":8d\n",'t') | call feedkeys("u",'t') | call feedkeys("zo",'t') | call feedkeys("dw",'t') | call feedkeys(":q!\n",'t') | endfun | | profile func Profile | | call Profile() `---- (Notice, that first deleting the whole fold starting at line 8 and then undoing the deletion will make vim unresponsive for several minutes: c...@t41:~$ time vim -u simple_vimrc -U NONE -N "layer.php" "layer.php" 1595L, 39500C Press ENTER or type command to continue real 3m4.249s user 2m58.199s sys 0m1.460s c...@t41:~$ Profiling did not resolve anything special: FUNCTION Profile() Called 1 time Total time: 0.505644 Self time: 0.390492 count total (s) self (s) 1 0.079991 0.000270 | syntax on 1 0.425550 0.390119 | e layer.php 1 0.000023 | set fdm=syntax | "call feedkeys(":set synmaxcol=100\n", 't') 1 0.000032 | call feedkeys(":8d\n",'t') 1 0.000006 | call feedkeys("u",'t') 1 0.000005 | call feedkeys("zo",'t') 1 0.000005 | call feedkeys("dw",'t') 1 0.000005 | call feedkeys(":q!\n",'t') FUNCTIONS SORTED ON TOTAL TIME count total (s) self (s) function 1 0.505644 0.390492 Profile() FUNCTIONS SORTED ON SELF TIME count total (s) self (s) function 1 0.505644 0.390492 Profile() If you comment out the lines 8 and 7 it works ok: c...@t41:~$ cat simple_vimrc && time vim -u simple_vimrc -U NONE -N profile start my_profile_php3 fun Profile() syntax on e layer.php set fdm=syntax "call feedkeys(":set synmaxcol=100\n", 't') "call feedkeys(":8d\n",'t') "call feedkeys("u",'t') call feedkeys("zo",'t') call feedkeys("dw",'t') call feedkeys(":q!\n",'t') endfun profile func Profile call Profile() "layer.php" "layer.php" 1595L, 39500C Press ENTER or type command to continue real 0m1.024s user 0m0.900s sys 0m0.048s One thing that helps a little is to set synmaxcol to a much lower value: c...@t41:~$ cat simple_vimrc && time vim -u simple_vimrc -U NONE -N profile start my_profile_php4 fun Profile() syntax on e layer.php set fdm=syntax call feedkeys(":set synmaxcol=100\n", 't') call feedkeys(":8d\n",'t') call feedkeys("u",'t') call feedkeys("zo",'t') call feedkeys("dw",'t') call feedkeys(":q!\n",'t') endfun profile func Profile call Profile() "layer.php" "layer.php" 1595L, 39500C Press ENTER or type command to continue real 0m23.974s user 0m23.293s sys 0m0.216s BTW: using the debian provided syntax files, does not show the problem: c...@t41:~$ cat simple_vimrc && time vim -u simple_vimrc -U NONE -N let php_folding=1 profile start my_profile_php6 fun Profile() syntax on e layer.php set fdm=syntax "call feedkeys(":set synmaxcol=100\n", 't') call feedkeys(":8d\n",'t') call feedkeys("u",'t') call feedkeys("zo",'t') call feedkeys("dw",'t') call feedkeys(":q!\n",'t') endfun profile func Profile call Profile() "layer.php" "layer.php" 1595L, 39500C Press ENTER or type command to continue real 0m3.506s user 0m3.292s sys 0m0.096s [1] To make sure, I run this test as a separate user with a new ~/.vim directory that contains only these files: c...@t41:~$ find .vim/ .vim/ .vim/syntax .vim/syntax/php.vim :scriptnames does show, that some standard plugins are loaded: 1: /home/cb/simple_vimrc 2: /usr/share/vim/vim72/syntax/syntax.vim 3: /usr/share/vim/vim72/syntax/synload.vim 4: /usr/share/vim/vim72/syntax/syncolor.vim 5: /usr/share/vim/vim72/filetype.vim 6: /home/cb/.vim/syntax/php.vim 7: /usr/share/vim/vim72/syntax/php.vim 8: /usr/share/vim/vim72/plugin/getscriptPlugin.vim 9: /usr/share/vim/vim72/plugin/gzip.vim 10: /usr/share/vim/vim72/plugin/matchparen.vim 11: /usr/share/vim/vim72/plugin/netrwPlugin.vim 12: /usr/share/vim/vim72/plugin/rrhelper.vim 13: /usr/share/vim/vim72/plugin/spellfile.vim 14: /usr/share/vim/vim72/plugin/tarPlugin.vim 15: /usr/share/vim/vim72/plugin/tohtml.vim 16: /usr/share/vim/vim72/plugin/vimballPlugin.vim 17: /usr/share/vim/vim72/plugin/zipPlugin.vim regards Christian -- 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
