Sunday, October 27, 2013

Re: Vim on an embedded system

<meino.cramer@gmx.de> wrote:

> Hi,
>
> I am running vim on a Beaglebone Black with Gentoo Linux
> (512MB DD3, 1GHZ ARM Cortex A8 CPU). I am connected to the
> Beaglebone black via SSH, which is -- for example while
> using shell commands -- fast.
>
> Currently I am mainly editing Lua code. Unfortunately this
> seems to be damn slow...partly I am waiting for the characters
> to appear on the screen or that a movement of the cursor finally
> happens.
>
> I had compiled vim natively on the Beaglebone Black with all
> features I am using on my PC.
>
> I am using vim exclusively -- NOT gvim -- from the console. I am
> currently not using X11 on the Beaglebone Black for vim editing
> sessions.
>
> vim --version shows:
>
> VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Oct 3 2013 05:57:29)
> Included patches: 1-50
> Compiled by root@beagleboneblack
> Huge version with GTK2 GUI. Features included (+) or not (-):
> +acl +farsi +mouse_netterm +syntax
> +arabic +file_in_path +mouse_sgr +tag_binary
> +autocmd +find_in_path -mouse_sysmouse +tag_old_static
> +balloon_eval +float +mouse_urxvt -tag_any_white
> +browse +folding +mouse_xterm -tcl
> ++builtin_terms -footer +multi_byte +terminfo
> +byte_offset +fork() +multi_lang +termresponse
> +cindent +gettext -mzscheme +textobjects
> +clientserver -hangul_input +netbeans_intg +title
> +clipboard +iconv +path_extra +toolbar
> +cmdline_compl +insert_expand -perl +user_commands
> +cmdline_hist +jumplist +persistent_undo +vertsplit
> +cmdline_info +keymap +postscript +virtualedit
> +comments +langmap +printer +visual
> +conceal +libcall +profile +visualextra
> +cryptv +linebreak -python +viminfo
> +cscope +lispindent -python3 +vreplace
> +cursorbind +listcmds +quickfix +wildignore
> +cursorshape +localmap +reltime +wildmenu
> +dialog_con_gui +lua +rightleft +windows
> +diff +menu -ruby +writebackup
> +digraphs +mksession +scrollbind +X11
> +dnd +modify_fname +signs -xfontset
> -ebcdic +mouse +smartindent +xim
> +emacs_tags +mouseshape -sniff +xsmp_interact
> +eval +mouse_dec +startuptime +xterm_clipboard
> +ex_extra +mouse_gpm +statusline -xterm_save
> +extra_search -mouse_jsbterm -sun_workshop +xpm
> system vimrc file: "$VIM/vimrc"
> user vimrc file: "$HOME/.vimrc"
> 2nd user vimrc file: "~/.vim/vimrc"
> user exrc file: "$HOME/.exrc"
> system gvimrc file: "$VIM/gvimrc"
> user gvimrc file: "$HOME/.gvimrc"
> 2nd user gvimrc file: "~/.vim/gvimrc"
> system menu file: "$VIMRUNTIME/menu.vim"
> fall-back for $VIM: "/usr/local/share/vim"
> Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng15 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/local/include -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
> Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfreetype -lfontconfig -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -lncurses -lelf -lnsl -lacl -lattr -lgpm -ldl -L/usr/lib -llua
>
> Is there anything I can compile differently to give me better
> performance by mainly preserve the features?
> (Or -- and not meant total seriously -- I dont want to strip off features
> until I have a lighning fast ed... :)
>
> The gcc compiles hardfloat using the mpu.
>
> Thank you very much in advance for any speed improvement hint! :)
>
> Best regards,
> mcc


Is the bottleneck CPU (vim using ~100% of CPU?)
or memory (machine swaps)?

If Vim is slow because of CPU, try to profile with with gprof or with
"valgrind --tool=callgrind vim". This will create a file callgrind.out.???
(where ??? is a process ID. You can view results with:
"kcachegrind callgrind.out.???"

I also see that you compiled with -O2. Try using -O3 instead.

If the bottleneck is memory, you can make vim use less
memory. For example:

* Use "set re=1" to use the old regexp engine which uses less memory
* Set a small value for 'undolevel' (or even disable it)
* turn spell checking off (dictionary probably use lots of memory)
* disable at compilation time features that you don't need
(do you really need the GTK2 GUI for example?)
* Compile with "-Os" (optimize for size) instead of "-O2"
* probably many other tips to save memory.

Here is the size of vim in bytes with different gcc-4.8.1
compilation options on my machine and the time it
takes to load & render a large xml file:

size vim size vim time to load/display big
unstrip strip xml file (3 samples)
---------- --------- ----------------------
-O3 .... 12,362,076 2,997,672 1.188s 1.207s 1.188s
-O2 .... 9,120,895 2,292,520 1.200s 1.201s 1.191s
-Os .... 7,365,634 1,861,320 1.354s 1.356s 1.364s

Regards
Dominique

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: