Skip to content

Instantly share code, notes, and snippets.

@rivertam
Created June 24, 2017 02:45
Show Gist options
  • Save rivertam/6e09ff29b0b75c54ca17bd79b6992fb1 to your computer and use it in GitHub Desktop.
Save rivertam/6e09ff29b0b75c54ca17bd79b6992fb1 to your computer and use it in GitHub Desktop.
Neovim profiling
FUNCTION airline#extensions#neomake#get_errors()
Called 340 times
Total time: 0.006676
Self time: 0.002922
count total (s) self (s)
340 0.005072 0.001318 let counts = neomake#statusline#LoclistCounts()
340 0.000847 let errors = get(counts, 'E', 0)
340 0.000525 return errors ? s:error_symbol.errors : ''
FUNCTION airline#statusline()
Called 340 times
Total time: 0.007183
Self time: 0.007183
count total (s) self (s)
340 0.003631 if has_key(s:contexts, a:winnr)
340 0.002505 return '%{airline#check_mode('.a:winnr.')}'.s:contexts[a:winnr].line
endif
" in rare circumstances this happens...see #276
return ''
FUNCTION airline#check_mode()
Called 340 times
Total time: 0.029613
Self time: 0.029613
count total (s) self (s)
340 0.001338 let context = s:contexts[a:winnr]
340 0.000943 if get(w:, 'airline_active', 1)
340 0.000881 let l:m = mode()
340 0.000582 if l:m ==# "i"
let l:mode = ['insert']
elseif l:m ==# "R"
let l:mode = ['replace']
elseif l:m =~# '\v(v|V||s|S|)'
let l:mode = ['visual']
elseif l:m ==# "t"
let l:mode = ['terminal']
else
340 0.000874 let l:mode = ['normal']
340 0.000239 endif
340 0.001457 let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m)
340 0.000260 else
let l:mode = ['inactive']
let w:airline_current_mode = get(g:airline_mode_map, '__')
endif
340 0.001337 if g:airline_detect_modified && &modified
call add(l:mode, 'modified')
endif
340 0.000555 if g:airline_detect_paste && &paste
call add(l:mode, 'paste')
endif
340 0.003639 if g:airline_detect_crypt && exists("+key") && !empty(&key)
call add(l:mode, 'crypt')
endif
340 0.000599 if g:airline_detect_spell && &spell
call add(l:mode, 'spell')
endif
340 0.000582 if &readonly || ! &modifiable
call add(l:mode, 'readonly')
endif
340 0.001469 let mode_string = join(l:mode)
340 0.001075 if get(w:, 'airline_lastmode', '') != mode_string
call airline#highlighter#highlight_modified_inactive(context.bufnr)
call airline#highlighter#highlight(l:mode, context.bufnr)
let w:airline_lastmode = mode_string
endif
340 0.000343 return ''
FUNCTION airline#extensions#neomake#get_warnings()
Called 340 times
Total time: 0.004879
Self time: 0.002413
count total (s) self (s)
340 0.003506 0.001040 let counts = neomake#statusline#LoclistCounts()
340 0.000714 let warnings = get(counts, 'W', 0)
340 0.000493 return warnings ? s:warning_symbol.warnings : ''
FUNCTION airline#parts#filetype()
Called 340 times
Total time: 0.001987
Self time: 0.001987
count total (s) self (s)
340 0.001753 return winwidth(0) < 90 && strlen(&filetype) > 3 ? matchstr(&filetype, '...'). (&encoding is? 'utf-8' ? '…' : '>') : &filetype
FUNCTION <SNR>47_sub()
Called 340 times
Total time: 0.004701
Self time: 0.004701
count total (s) self (s)
340 0.004532 return substitute(a:str,'\v\C'.a:pat,a:rep,'')
FUNCTION <SNR>139_cursormoved_delayed_cb()
Called 15 times
Total time: 0.001627
Self time: 0.000375
count total (s) self (s)
15 0.000212 if getpos('.') == s:cursormoved_last_pos
15 0.001371 0.000118 call neomake#CursorMoved()
15 0.000011 endif
FUNCTION neomake#CursorMovedDelayed()
Called 318 times
Total time: 0.009661
Self time: 0.009661
count total (s) self (s)
318 0.001876 if exists('s:cursormoved_timer')
318 0.001347 call timer_stop(s:cursormoved_timer)
318 0.000391 endif
318 0.003791 let s:cursormoved_timer = timer_start(get(g:, 'neomake_cursormoved_delay', 100), function('s:cursormoved_delayed_cb'))
318 0.001531 let s:cursormoved_last_pos = getpos('.')
FUNCTION <SNR>47_repo()
Called 680 times
Total time: 0.015959
Self time: 0.015959
count total (s) self (s)
680 0.003563 let dir = a:0 ? a:1 : (exists('b:git_dir') && b:git_dir !=# '' ? b:git_dir : fugitive#extract_git_dir(expand('%:p')))
680 0.000642 if dir !=# ''
680 0.001352 if has_key(s:repos, dir)
680 0.001456 let repo = get(s:repos, dir)
680 0.000383 else
let repo = {'git_dir': dir}
let s:repos[dir] = repo
endif
680 0.005656 return extend(extend(repo, s:repo_prototype, 'keep'), s:abstract_prototype, 'keep')
endif
call s:throw('not a git repository: '.expand('%:p'))
FUNCTION neomake#statusline#LoclistCounts()
Called 680 times
Total time: 0.006220
Self time: 0.006220
count total (s) self (s)
680 0.002069 let buf = a:0 ? a:1 : bufnr('%')
680 0.000704 if buf is# 'all'
return s:loclist_counts
endif
680 0.001962 return get(s:loclist_counts, buf, {})
FUNCTION <SNR>125_update()
Called 318 times
Total time: 0.013743
Self time: 0.013743
count total (s) self (s)
318 0.007062 if match(&ft, get(g:, 'airline#extensions#wordcount#filetypes')) > -1
let l:mode = mode()
if l:mode ==# 'v' || l:mode ==# 'V' || l:mode ==# 's' || l:mode ==# 'S'
let b:airline_wordcount = airline#extensions#wordcount#formatters#{s:formatter}#format()
let b:airline_change_tick = b:changedtick
else
if get(b:, 'airline_wordcount_cache', '') is# '' || b:airline_wordcount_cache isnot# get(b:, 'airline_wordcount', '') || get(b:, 'airline_change_tick', 0) != b:changedtick
" cache data
let b:airline_wordcount = airline#extensions#wordcount#formatters#{s:formatter}#format()
let b:airline_wordcount_cache = b:airline_wordcount
let b:airline_change_tick = b:changedtick
endif
endif
endif
FUNCTION airline#util#wrap()
Called 1700 times
Total time: 0.007219
Self time: 0.007219
count total (s) self (s)
1700 0.003008 if a:minwidth > 0 && winwidth(0) < a:minwidth
return ''
endif
1700 0.001478 return a:text
FUNCTION airline#extensions#whitespace#check()
Called 340 times
Total time: 0.029195
Self time: 0.024173
count total (s) self (s)
340 0.002095 if &readonly || !&modifiable || !s:enabled || line('$') > s:max_lines || get(b:, 'airline_whitespace_disabled', 0)
return ''
endif
340 0.000825 if !exists('b:airline_whitespace_check')
let b:airline_whitespace_check = ''
let checks = get(b:, 'airline_whitespace_checks', get(g:, 'airline#extensions#whitespace#checks', s:default_checks))
let trailing = 0
if index(checks, 'trailing') > -1
try
let regexp = get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$')
let trailing = search(regexp, 'nw')
catch
echomsg 'airline#whitespace: error occured evaluating '. regexp
echomsg v:exception
return ''
endtry
endif
let mixed = 0
let check = 'indent'
if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0
let mixed = s:check_mixed_indent()
endif
let mixed_file = ''
let check = 'mixed-indent-file'
if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0
let mixed_file = s:check_mixed_indent_file()
endif
let long = 0
if index(checks, 'long') > -1 && &tw > 0
let long = search('\%>'.&tw.'v.\+', 'nw')
endif
if trailing != 0 || mixed != 0 || long != 0 || !empty(mixed_file)
let b:airline_whitespace_check = s:symbol
if strlen(s:symbol) > 0
let space = (g:airline_symbols.space)
else
let space = ''
endif
if s:show_message
if trailing != 0
let b:airline_whitespace_check .= space.printf(s:trailing_format, trailing)
endif
if mixed != 0
let b:airline_whitespace_check .= space.printf(s:mixed_indent_format, mixed)
endif
if long != 0
let b:airline_whitespace_check .= space.printf(s:long_format, long)
endif
if !empty(mixed_file)
let b:airline_whitespace_check .= space.printf(s:mixed_indent_file_format, mixed_file)
endif
endif
endif
endif
340 0.006377 0.001356 return airline#util#shorten(b:airline_whitespace_check, 120, 9)
FUNCTION <SNR>117_sync_active_winnr()
Called 318 times
Total time: 0.002618
Self time: 0.002618
count total (s) self (s)
318 0.001537 if exists('#airline') && winnr() != s:active_winnr
call airline#update_statusline()
endif
FUNCTION neomake#CursorMoved()
Called 15 times
Total time: 0.001253
Self time: 0.000104
count total (s) self (s)
15 0.001246 0.000097 call neomake#EchoCurrentError()
FUNCTION neomake#EchoCurrentError()
Called 15 times
Total time: 0.001149
Self time: 0.001149
count total (s) self (s)
" a:1 might be a timer from the VimResized event.
15 0.000064 let force = a:0 ? a:1 : 0
15 0.000078 if !force && !get(g:, 'neomake_echo_current_error', 1)
return
endif
15 0.000047 let buf = bufnr('%')
15 0.000040 let ln = line('.')
15 0.000038 let ln_errors = []
45 0.000107 for maker_type in ['file', 'project']
30 0.000201 let buf_errors = get(s:current_errors[maker_type], buf, {})
30 0.000146 let ln_errors += get(buf_errors, ln, [])
30 0.000031 endfor
15 0.000030 if empty(ln_errors)
15 0.000055 if exists('s:neomake_last_echoed_error')
echon ''
unlet s:neomake_last_echoed_error
endif
15 0.000015 return
endif
if len(ln_errors) > 1
let ln_errors = copy(ln_errors)
call sort(ln_errors, function('neomake#utils#sort_by_col'))
endif
let error_entry = ln_errors[0]
if !force && exists('s:neomake_last_echoed_error') && s:neomake_last_echoed_error == error_entry
return
endif
let s:neomake_last_echoed_error = error_entry
let message = error_entry.maker_name.': '.error_entry.text
call neomake#utils#WideMessage(message)
FUNCTION <SNR>47_repo_dir()
Called 680 times
Total time: 0.003028
Self time: 0.003028
count total (s) self (s)
680 0.002797 return join([self.git_dir]+a:000,'/')
FUNCTION airline#parts#mode()
Called 340 times
Total time: 0.007385
Self time: 0.002615
count total (s) self (s)
340 0.007141 0.002371 return airline#util#shorten(get(w:, 'airline_current_mode', ''), 79, 1)
FUNCTION fugitive#head()
Called 340 times
Total time: 0.051789
Self time: 0.004517
count total (s) self (s)
340 0.000857 if !exists('b:git_dir')
return ''
endif
340 0.050147 0.002875 return s:repo().head(a:0 ? a:1 : 0)
FUNCTION <SNR>101_Highlight_Matching_Pair()
Called 318 times
Total time: 0.838739
Self time: 0.838739
count total (s) self (s)
" Remove any previous match.
318 0.001006 if exists('w:paren_hl_on') && w:paren_hl_on
183 0.001617 silent! call matchdelete(3)
183 0.000325 let w:paren_hl_on = 0
183 0.000153 endif
" Avoid that we remove the popup menu.
" Return when there are no colors (looks like the cursor jumps).
318 0.001228 if pumvisible() || (&t_Co < 8 && !has("gui_running"))
return
endif
" Get the character under the cursor and check if it's in 'matchpairs'.
318 0.000780 let c_lnum = line('.')
318 0.000593 let c_col = col('.')
318 0.000355 let before = 0
318 0.000816 let text = getline(c_lnum)
318 0.005223 let matches = matchlist(text, '\(.\)\=\%'.c_col.'c\(.\=\)')
318 0.000700 if empty(matches)
let [c_before, c] = ['', '']
else
318 0.001401 let [c_before, c] = matches[1:2]
318 0.000230 endif
318 0.003625 let plist = split(&matchpairs, '.\zs[:,]')
318 0.000998 let i = index(plist, c)
318 0.000355 if i < 0
" not found, in Insert mode try character before the cursor
134 0.000443 if c_col > 1 && (mode() == 'i' || mode() == 'R')
let before = strlen(c_before)
let c = c_before
let i = index(plist, c)
endif
134 0.000142 if i < 0
" not found, nothing to do
134 0.000153 return
endif
endif
" Figure out the arguments for searchpairpos().
184 0.000253 if i % 2 == 0
85 0.000132 let s_flags = 'nW'
85 0.000203 let c2 = plist[i + 1]
85 0.000062 else
99 0.000137 let s_flags = 'nbW'
99 0.000265 let c2 = c
99 0.000205 let c = plist[i - 1]
99 0.000064 endif
184 0.000253 if c == '['
let c = '\['
let c2 = '\]'
endif
" Find the match. When it was just before the cursor move it there for a
" moment.
184 0.000199 if before > 0
let has_getcurpos = exists("*getcurpos")
if has_getcurpos
" getcurpos() is more efficient but doesn't exist before 7.4.313.
let save_cursor = getcurpos()
else
let save_cursor = winsaveview()
endif
call cursor(c_lnum, c_col - before)
endif
" Build an expression that detects whether the current cursor position is in
" certain syntax types (string, comment, etc.), for use as searchpairpos()'s
" skip argument.
" We match "escape" for special items, such as lispEscapeSpecial.
184 0.000755 let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' . '''v:val =~? "string\\|character\\|singlequote\\|escape\\|comment"''))'
" If executing the expression determines that the cursor is currently in
" one of the syntax types, then we want searchpairpos() to find the pair
" within those syntax types (i.e., not skip). Otherwise, the cursor is
" outside of the syntax types and s_skip should keep its value so we skip any
" matching pair inside the syntax types.
184 0.033248 execute 'if' s_skip '| let s_skip = 0 | endif'
" Limit the search to lines visible in the window.
184 0.000547 let stoplinebottom = line('w$')
184 0.000403 let stoplinetop = line('w0')
184 0.000259 if i % 2 == 0
85 0.000212 let stopline = stoplinebottom
85 0.000063 else
99 0.000216 let stopline = stoplinetop
99 0.000057 endif
" Limit the search time to 300 msec to avoid a hang on very long lines.
" This fails when a timeout is not supported.
184 0.000447 if mode() == 'i' || mode() == 'R'
let timeout = exists("b:matchparen_insert_timeout") ? b:matchparen_insert_timeout : g:matchparen_insert_timeout
else
184 0.000756 let timeout = exists("b:matchparen_timeout") ? b:matchparen_timeout : g:matchparen_timeout
184 0.000108 endif
184 0.000259 try
184 0.750159 let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, timeout)
184 0.000480 catch /E118/
" Can't use the timeout, restrict the stopline a bit more to avoid taking
" a long time on closed folds and long lines.
" The "viewable" variables give a range in which we can scroll while
" keeping the cursor at the same position.
" adjustedScrolloff accounts for very large numbers of scrolloff.
let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2])
let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2])
let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2])
" one of these stoplines will be adjusted below, but the current values are
" minimal boundaries within the current window
if i % 2 == 0
if has("byte_offset") && has("syntax_items") && &smc > 0
let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2])
let stopline = min([bottom_viewable, byte2line(stopbyte)])
else
let stopline = min([bottom_viewable, c_lnum + 100])
endif
let stoplinebottom = stopline
else
if has("byte_offset") && has("syntax_items") && &smc > 0
let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2])
let stopline = max([top_viewable, byte2line(stopbyte)])
else
let stopline = max([top_viewable, c_lnum - 100])
endif
let stoplinetop = stopline
endif
let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline)
endtry
184 0.000267 if before > 0
if has_getcurpos
call setpos('.', save_cursor)
else
call winrestview(save_cursor)
endif
endif
" If a match is found setup match highlighting.
184 0.000524 if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom
184 0.000452 if exists('*matchaddpos')
184 0.005676 call matchaddpos('MatchParen', [[c_lnum, c_col - before], [m_lnum, m_col]], 10, 3)
184 0.000161 else
exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) . 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/'
endif
184 0.000332 let w:paren_hl_on = 1
184 0.000134 endif
FUNCTION airline#util#shorten()
Called 680 times
Total time: 0.009792
Self time: 0.009792
count total (s) self (s)
680 0.003374 if winwidth(0) < a:winwidth && len(split(a:text, '\zs')) > a:minwidth
if get(a:000, 0, 0)
" shorten from tail
return '…'.matchstr(a:text, '.\{'.a:minwidth.'}$')
else
" shorten from beginning of string
return matchstr(a:text, '^.\{'.a:minwidth.'}').'…'
endif
else
680 0.000653 return a:text
endif
FUNCTION <SNR>47_repo_head_ref()
Called 340 times
Total time: 0.017287
Self time: 0.014260
count total (s) self (s)
340 0.007910 0.006029 if !filereadable(self.dir('HEAD'))
return ''
endif
340 0.008530 0.007383 return readfile(self.dir('HEAD'))[0]
FUNCTION <SNR>47_repo_head()
Called 340 times
Total time: 0.037368
Self time: 0.009325
count total (s) self (s)
340 0.025483 0.002141 let head = s:repo().head_ref()
340 0.002006 if head =~# '^ref: '
340 0.006677 0.001976 let branch = s:sub(head,'^ref: %(refs/%(heads/|remotes/|tags/)=)=','')
340 0.000406 elseif head =~# '^\x\{40\}$'
" truncate hash to a:1 characters if we're in detached head mode
let len = a:0 ? a:1 : 0
let branch = len ? head[0:len-1] : ''
else
return ''
endif
340 0.000338 return branch
FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
318 0.838739 <SNR>101_Highlight_Matching_Pair()
340 0.051789 0.004517 fugitive#head()
340 0.037368 0.009325 <SNR>47_repo_head()
340 0.029613 airline#check_mode()
340 0.029195 0.024173 airline#extensions#whitespace#check()
340 0.017287 0.014260 <SNR>47_repo_head_ref()
680 0.015959 <SNR>47_repo()
318 0.013743 <SNR>125_update()
680 0.009792 airline#util#shorten()
318 0.009661 neomake#CursorMovedDelayed()
340 0.007385 0.002615 airline#parts#mode()
1700 0.007219 airline#util#wrap()
340 0.007183 airline#statusline()
340 0.006676 0.002922 airline#extensions#neomake#get_errors()
680 0.006220 neomake#statusline#LoclistCounts()
340 0.004879 0.002413 airline#extensions#neomake#get_warnings()
340 0.004701 <SNR>47_sub()
680 0.003028 <SNR>47_repo_dir()
318 0.002618 <SNR>117_sync_active_winnr()
340 0.001987 airline#parts#filetype()
FUNCTIONS SORTED ON SELF TIME
count total (s) self (s) function
318 0.838739 <SNR>101_Highlight_Matching_Pair()
340 0.029613 airline#check_mode()
340 0.029195 0.024173 airline#extensions#whitespace#check()
680 0.015959 <SNR>47_repo()
340 0.017287 0.014260 <SNR>47_repo_head_ref()
318 0.013743 <SNR>125_update()
680 0.009792 airline#util#shorten()
318 0.009661 neomake#CursorMovedDelayed()
340 0.037368 0.009325 <SNR>47_repo_head()
1700 0.007219 airline#util#wrap()
340 0.007183 airline#statusline()
680 0.006220 neomake#statusline#LoclistCounts()
340 0.004701 <SNR>47_sub()
340 0.051789 0.004517 fugitive#head()
680 0.003028 <SNR>47_repo_dir()
340 0.006676 0.002922 airline#extensions#neomake#get_errors()
318 0.002618 <SNR>117_sync_active_winnr()
340 0.007385 0.002615 airline#parts#mode()
340 0.004879 0.002413 airline#extensions#neomake#get_warnings()
340 0.001987 airline#parts#filetype()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment