LINUX.ORG.RU

vim высокое потребление процессорного времени

 


0

2

при скроле j\k наблюдается высокое потребление процессорного времени. До 100%. Дебаг лог такой:

FUNCTION  <SNR>139_initialize_source()
Called 1 time
Total time:   0.000172
 Self time:   0.000114

count  total (s)   self (s)
    1              0.000008   let path = fnamemodify(bufname(a:srcname), ':p')
    1              0.000002   let filename = fnamemodify(path, ':t')
    1              0.000001   if filename == ''
                                let filename = '[No Name]'
                                let path .= '/[No Name]'
                              endif
                            
                              " Set cache line count.
    1              0.000086   let buflines = getbufline(a:srcname, 1, '$')
    1              0.000002   let end_line = len(buflines)
                            
    1              0.000003   let ft = getbufvar(a:srcname, '&filetype')
    1              0.000001   if ft == ''
                                let ft = 'nothing'
                              endif
                            
    1   0.000065   0.000007   let s:member_sources[a:srcname] = { 'member_cache' : {}, 'filetype' : ft, 'keyword_pattern' : neocomplcache#get_keyword_pattern(ft),}

FUNCTION  neocomplcache#get_current_neocomplcache()
Called 21 times
Total time:   0.000119
 Self time:   0.000099

count  total (s)   self (s)
   21              0.000033   if !exists('b:neocomplcache')
    1   0.000025   0.000005     call neocomplcache#init#_current_neocomplcache()
    1              0.000001   endif
                            
   21              0.000014   return b:neocomplcache

FUNCTION  ctrlp#utils#mkdir()
Called 1 time
Total time:   0.000008
 Self time:   0.000008

count  total (s)   self (s)
    1              0.000005 	if exists('*mkdir') && !isdirectory(a:dir)
                            		sil! cal mkdir(a:dir, 'p')
                            	en
    1              0.000001 	retu a:dir

FUNCTION  <SNR>124__build_module()
Called 15 times
Total time:   0.028191
 Self time:   0.022916

count  total (s)   self (s)
   15              0.000045   if has_key(s:loaded, a:sid)
   11              0.000083     return copy(s:loaded[a:sid])
                              endif
    4              0.000008   let prefix = '<SNR>' . a:sid . '_'
    4   0.001393   0.000015   let funcs = s:_redir('function')
    4              0.000008   let filter_pat = '^\s*function ' . prefix
    4              0.000005   let map_pat = prefix . '\zs\w\+'
    4              0.009294   let functions = map(filter(split(funcs, "\n"), 'v:val =~# filter_pat'),          'matchstr(v:val, map_pat)')
                            
    4              0.000009   let module = {}
  112              0.000078   for func in functions
  108              0.000255     let module[func] = function(prefix . func)
  108              0.000049   endfor
    4              0.000008   if has_key(module, '_vital_loaded')
    1              0.004069     let V = vital#{s:self_version}#new()
    1              0.000001     if has_key(module, '_vital_depends')
    1   0.004170   0.004169       call call(V.load, module._vital_depends(), V)
    1              0.000000     endif
    1              0.000001     try
    1              0.004116       call module._vital_loaded(V)
    1              0.000001     catch
                                  " FIXME: Show an error message for debug.
                                endtry
    1              0.000000   endif
    4              0.000009   if !get(g:, 'vital_debug', 0)
    4              0.000213     call filter(module, 'v:key =~# "^\\a"')
    4              0.000002   endif
    4              0.000011   let s:loaded[a:sid] = module
    4              0.000021   return copy(module)

FUNCTION  neocomplcache#mappings#define_default_mappings()
Called 1 time
Total time:   0.000060
 Self time:   0.000060

count  total (s)   self (s)
    1              0.000022   inoremap <expr><silent> <Plug>(neocomplcache_start_unite_complete) unite#sources#neocomplcache#start_complete()
    1              0.000011   inoremap <expr><silent> <Plug>(neocomplcache_start_unite_quick_match) unite#sources#neocomplcache#start_quick_match()
    1              0.000011   inoremap <silent> <Plug>(neocomplcache_start_auto_complete) <C-x><C-u><C-r>=neocomplcache#mappings#popup_post()<CR>
    1              0.000007   inoremap <silent> <Plug>(neocomplcache_start_auto_complete_no_select) <C-x><C-u><C-p>
                              " \ <C-x><C-u><C-p>
    1              0.000006   inoremap <silent> <Plug>(neocomplcache_start_omni_complete) <C-x><C-o><C-p>

FUNCTION  <SNR>139_get_member_pattern()
Called 3 times
Total time:   0.000010
 Self time:   0.000010

count  total (s)   self (s)
    3              0.000008   return has_key(g:neocomplcache_member_patterns, a:filetype) ? g:neocomplcache_member_patterns[a:filetype] : g:neocomplcache_member_patterns['default']

FUNCTION  neocomplcache#context_filetype#set()
Called 2 times
Total time:   0.003625
 Self time:   0.000084

count  total (s)   self (s)
    2   0.000015   0.000007   let old_filetype = neocomplcache#get_current_neocomplcache().filetype
    2              0.000002   if old_filetype == ''
    2              0.000003     let old_filetype = &filetype
    2              0.000000   endif
    2              0.000002   if old_filetype == ''
                                let old_filetype = 'nothing'
                              endif
                            
    2   0.000012   0.000004   let neocomplcache = neocomplcache#get_current_neocomplcache()
                            
    2              0.000002   let dup_check = {}
    4              0.000001   while 1
    4   0.003544   0.000019     let new_filetype = neocomplcache#context_filetype#get(old_filetype)
                            
                                " Check filetype root.
    4              0.000011     if get(dup_check, old_filetype, '') ==# new_filetype
    2              0.000003       let neocomplcache.context_filetype = old_filetype
    2              0.000001       break
                                endif
                            
                                " Save old -> new filetype graph.
    2              0.000004     let dup_check[old_filetype] = new_filetype
    2              0.000002     let old_filetype = new_filetype
    2              0.000001   endwhile
                            
    2              0.000002   return neocomplcache.context_filetype

FUNCTION  455()
Called 1 time
Total time:   0.000201
 Self time:   0.000033

count  total (s)   self (s)
                              " Initialize.
                            
                              " Initialize filename include expr. "{{{
    1              0.000003   let g:neocomplcache_filename_include_exprs = get(g:, 'neocomplcache_filename_include_exprs', {})
    1   0.000038   0.000004   call neocomplcache#util#set_default_dictionary( 'g:neocomplcache_filename_include_exprs', 'perl', 'fnamemodify(substitute(v:fname, "/", "::", "g"), ":r")')
    1   0.000045   0.000005   call neocomplcache#util#set_default_dictionary( 'g:neocomplcache_filename_include_exprs', 'ruby,python,java,d', 'fnamemodify(substitute(v:fname, "/", ".", "g"), ":r")')
                              "}}}
                            
                              " Initialize filename include extensions. "{{{
    1              0.000003   let g:neocomplcache_filename_include_exts = get(g:, 'neocomplcache_filename_include_exts', {})
    1   0.000030   0.000004   call neocomplcache#util#set_default_dictionary( 'g:neocomplcache_filename_include_exts', 'c', ['h'])
    1   0.000027   0.000004   call neocomplcache#util#set_default_dictionary( 'g:neocomplcache_filename_include_exts', 'cpp', ['', 'h', 'hpp', 'hxx'])
    1   0.000026   0.000003   call neocomplcache#util#set_default_dictionary( 'g:neocomplcache_filename_include_exts', 'perl', ['pm'])
    1   0.000025   0.000003   call neocomplcache#util#set_default_dictionary( 'g:neocomplcache_filename_include_exts', 'java', ['java'])
                              "}}}

FUNCTION  neocomplcache#init#_others()
Called 1 time
Total time:   0.068457
 Self time:   0.000347

count  total (s)   self (s)
    1   0.067368   0.000006   call neocomplcache#init#_variables()
                            
    1   0.000547   0.000109   call neocomplcache#context_filetype#initialize()
                            
    1   0.000238   0.000103   call neocomplcache#commands#_initialize()
                            
                              " Save options.
    1              0.000002   let s:completefunc_save = &completefunc
    1              0.000002   let s:completeopt_save = &completeopt
                            
                              " Set completefunc.
    1              0.000002   let completefunc_save = &l:completefunc
    1              0.000002   let &completefunc = 'neocomplcache#complete#manual_complete'
    1              0.000001   if completefunc_save != ''
                                let &l:completefunc = completefunc_save
                              endif
                            
                              " For auto complete keymappings.
    1   0.000279   0.000104   call neocomplcache#mappings#define_default_mappings()
                            
                              " Detect set paste.
    1              0.000000   if &paste
                                redir => output
                                99verbose set paste
                                redir END
                                call neocomplcache#print_error(output)
                                call neocomplcache#print_error( 'Detected set paste! Disabled neocomplcache.')
                              endif
                            
    1              0.000006   command! -nargs=0 -bar NeoComplCacheDisable call neocomplcache#init#disable()

FUNCTION  vital#of()
Called 4 times
Total time:   0.042636
 Self time:   0.001399

count  total (s)   self (s)
    4              0.001163   let files = globpath(&runtimepath, 'autoload/vital/' . a:name . '.vital')
    4              0.000028   let file = split(files, "\n")
    4              0.000004   if empty(file)
                                throw 'vital: version file not found: ' . a:name
                              endif
    4              0.000059   let ver = readfile(file[0], 'b')
    4              0.000005   if empty(ver)
                                throw 'vital: invalid version file: ' . a:name
                              endif
    4   0.041359   0.000122   return vital#_{substitute(ver[0], '\W', '', 'g')}#new()

FUNCTION  neocomplcache#init#_source()
Called 10 times
Total time:   0.002548
 Self time:   0.000621

count  total (s)   self (s)
   10   0.000199   0.000096   let default = { 'max_candidates' : 0, 'filetypes' : {}, 'hooks' : {}, 'matchers' : ['matcher_old'], 'sorters' : ['sorter_rank'], 'converters' : [      'converter_remove_next_keyword',      'converter_delimiter',      'converter_case',      'converter_abbr', ], 'neocomplcache__context' : copy(neocomplcache#get_context()), }
                            
   10              0.000065   let source = extend(copy(default), a:source)
                            
                              " Overwritten by user custom.
   10   0.000080   0.000029   let custom = neocomplcache#variables#get_custom().sources
   10              0.000041   let source = extend(source, get(custom, source.name, get(custom, '_', {})))
                            
   10              0.000012   let source.loaded = 0
                              " Source kind convertion.
   10              0.000037   if source.kind ==# 'plugin' || (!has_key(source, 'gather_candidates') &&  !has_key(source, 'get_complete_words'))
    4              0.000004     let source.kind = 'keyword'
    4              0.000004   elseif source.kind ==# 'ftplugin' || source.kind ==# 'complfunc'
                                " For compatibility.
                                let source.kind = 'manual'
                              else
    6              0.000006     let source.kind = 'manual'
    6              0.000002   endif
                            
   10              0.000011   if !has_key(source, 'rank')
                                " Set default rank.
    1              0.000003     let source.rank = (source.kind ==# 'keyword') ? 5 : empty(source.filetypes) ? 10 : 100
    1              0.000000   endif
                            
   10              0.000011   if !has_key(source, 'min_pattern_length')
                                " Set min_pattern_length.
    6              0.000016     let source.min_pattern_length = (source.kind ==# 'keyword') ? g:neocomplcache_auto_completion_start_length : 0
    6              0.000003   endif
                            
   10              0.000015   let source.neocomplcache__context.source_name = source.name
                            
                              " Note: This routine is for compatibility of old sources implementation.
                              " Initialize sources.
   10              0.000018   if empty(source.filetypes) && has_key(source, 'initialize')
    8              0.000008     try
    8   0.001800   0.000027       call source.initialize()
    8              0.000005     catch
                                  call neocomplcache#print_error(v:throwpoint)
                                  call neocomplcache#print_error(v:exception)
                                  call neocomplcache#print_error( 'Error occurred in source''s initialize()!')
                                  call neocomplcache#print_error( 'Source name is ' . source.name)
                                endtry
                            
    8              0.000009     let source.loaded = 1
    8              0.000000   endif
                            
   10              0.000006   return source

FUNCTION  neocomplcache#util#set_default()
Called 19 times
Total time:   0.000174
 Self time:   0.000174

count  total (s)   self (s)
   19              0.000064   if !exists(a:var) || type({a:var}) != type(a:val)
   12              0.000023     let alternate_var = get(a:000, 0, '')
                            
   12              0.000039     let {a:var} = exists(alternate_var) ? {alternate_var} : a:val
   12              0.000006   endif

FUNCTION  <SNR>56_QuitPreHook()
Called 1 time
Total time:   0.000056
 Self time:   0.000033

count  total (s)   self (s)
    1   0.000032   0.000017     call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS, 'autocmd: QuitPre, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
    1   0.000018   0.000010     let b:syntastic_skip_checks = get(b:, 'syntastic_skip_checks', 0) || !syntastic#util#var('check_on_wq')
    1              0.000003     if get(w:, 'syntastic_loclist_set', 0)
                                    call SyntasticLoclistHide()
                                endif

FUNCTIONS SORTED ON TOTAL TIME
count  total (s)   self (s)  function
    3   0.091510   0.000185  neocomplcache#init#lazy()
    1   0.068457   0.000347  neocomplcache#init#_others()
    1   0.067362   0.000569  neocomplcache#init#_variables()
   15   0.058686   0.029568  <SNR>124__scripts()
    5   0.049378   0.000111  vital#_13055f8#new()
    4   0.042636   0.001399  vital#of()
    4   0.039894   0.000129  <SNR>124_import()
   15   0.034059   0.000720  <SNR>124__import()
    6   0.030217   0.000449  <SNR>124_load()
   15   0.028191   0.022916  <SNR>124__build_module()
 1944   0.027139             <SNR>124__unify_path()
    1   0.022333   0.002182  neocomplcache#init#_sources()
  186   0.010788             <SNR>93_Highlight_Matching_Pair()
    3   0.007449   0.000583  signature#sign#Refresh()
   15   0.004446   0.004112  <SNR>124__get_module_path()
    1   0.004145   0.000007  <SNR>127__vital_loaded()
    6   0.004089             signature#mark#GetList()
  158   0.004013   0.001479  neocomplcache#util#set_default_dictionary()
    4   0.003691   0.000041  neocomplcache#get_context_filetype()
   19   0.003665             <SNR>124__redir()

FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
   15   0.058686   0.029568  <SNR>124__scripts()
 1944              0.027139  <SNR>124__unify_path()
   15   0.028191   0.022916  <SNR>124__build_module()
  186              0.010788  <SNR>93_Highlight_Matching_Pair()
   15   0.004446   0.004112  <SNR>124__get_module_path()
    6              0.004089  signature#mark#GetList()
   19              0.003665  <SNR>124__redir()
    4   0.003525   0.003508  neocomplcache#context_filetype#get()
  156              0.002464  signature#sign#Remove()
    1   0.022333   0.002182  neocomplcache#init#_sources()
  158              0.002099  <SNR>125_set_dictionary_helper()
  158   0.004013   0.001479  neocomplcache#util#set_default_dictionary()
    4   0.042636   0.001399  vital#of()
    1   0.003123   0.001043  <SNR>139_caching_current_buffer()
   15   0.034059   0.000720  <SNR>124__import()
   10   0.002548   0.000621  neocomplcache#init#_source()
    3   0.007449   0.000583  signature#sign#Refresh()
    1   0.067362   0.000569  neocomplcache#init#_variables()
    6   0.030217   0.000449  <SNR>124_load()
  158   0.002534   0.000435  neocomplcache#util#set_dictionary_helper()
Пробовал запускать с опцией --noplugin. Тогда лог не пишет, но потребление в районе ~30-40%. Как с этим бороться и возможно ли это ?

★★★★

Последнее исправление: bryak (всего исправлений: 1)

Может дело в подсветке? С :syntax off такое наблюдается?

neocomplcache

Устарел же, юзай neocomplete.

Пробовал запускать с опцией --noplugin. Тогда лог не пишет

Сапроизвольно лог пишет?

salsa
()

а какой процесс потребляет столько: vim или терминал?

и да, как выше сказали, используй neocomplete от того же автора, потому что neocomlcache дропнут года 2 назад.

vim --version

покажи.

kep
()
Ответ на: комментарий от kep

в общем проверил у себя на vim-7.4.891 — такого нет, процесс вима на постоянном скролле jk (хотя это неправильно в плане навигации) относительно большого (3800 строк) файла ничего не лагает и процессорного времени процесс vim потребляет не более 10%, терминал же (termite) не более 15%.

это при всех включенных плагинах, подсветках и т.п.

рекомендую обновить вим до свежайшего и перейти на нормальный вимерский терминал (termite, например).

kep
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.