Skip to content

Instantly share code, notes, and snippets.

@nhooey
Created February 3, 2014 17:14
Show Gist options
  • Save nhooey/8788027 to your computer and use it in GitHub Desktop.
Save nhooey/8788027 to your computer and use it in GitHub Desktop.
GitGutter profile
FUNCTION sign#find_current_signs()
Called 72 times
Total time: 0.073710
Self time: 0.073710
count total (s) self (s)
72 0.000987 let gitgutter_signs = {} " <line_number>: {'id': <id>, 'name': <name>}
72 0.000401 let other_signs = []
72 0.000545 redir => signs
72 0.004239 silent execute "sign place file=" . a:file_name
72 0.000467 redir END
247 0.003460 for sign_line in filter(split(signs, '\n'), 'v:val =~# "="')
" Typical sign line: line=88 id=1234 name=GitGutterLineAdded
" We assume splitting is faster than a regexp.
175 0.003276 let components = split(sign_line)
175 0.001810 let name = split(components[2], '=')[1]
175 0.001174 if name !~# 'GitGutterDummy'
131 0.001327 let line_number = str2nr(split(components[0], '=')[1])
131 0.000683 if name =~# 'GitGutter'
131 0.001230 let id = str2nr(split(components[1], '=')[1])
131 0.001063 let gitgutter_signs[line_number] = {'id': id, 'name': name}
131 0.000187 else
call add(other_signs, line_number)
endif
131 0.000067 end
175 0.000137 endfor
72 0.025904 call setbufvar(a:file_name, 'gitgutter_gitgutter_signs', gitgutter_signs)
72 0.021280 call setbufvar(a:file_name, 'gitgutter_other_signs', other_signs)
FUNCTION diff#is_modified()
Called 17 times
Total time: 0.000112
Self time: 0.000112
count total (s) self (s)
17 0.000076 return a:from_count > 0 && a:to_count > 0 && a:from_count == a:to_count
FUNCTION <SNR>40_TabWinEnter()
Called 7 times
Total time: 0.000235
Self time: 0.000235
count total (s) self (s)
7 0.000070 if exists('t:tab_name')
7 0.000124 call setwinvar(winnr(), "tab_win_name", t:tab_name)
7 0.000017 endif
FUNCTION utility#escape()
Called 150 times
Total time: 0.009777
Self time: 0.009777
count total (s) self (s)
150 0.000801 if &shellxquote ==# '"'
return '"' . substitute(a:str, '"', '""', 'g') . '"'
else
150 0.000708 let esc = exists('+shellxescape') ? &shellxescape : '"&|<>()@^'
150 0.006488 return &shellquote . substitute(a:str, '['.esc.']', '&', 'g') . get({'(': ')', '"(': ')"'}, &shellquote, &shellquote)
endif
FUNCTION <SNR>56_BETabEnter()
Called 7 times
Total time: 0.000165
Self time: 0.000165
count total (s) self (s)
" Make s:tabSpace 1-based
7 0.000088 if empty(s:tabSpace) || len(s:tabSpace) < (tabpagenr() + 1)
call add(s:tabSpace, [-1])
endif
FUNCTION diff#process_hunks()
Called 72 times
Total time: 0.013196
Self time: 0.003720
count total (s) self (s)
72 0.004162 0.001116 call hunk#reset()
72 0.000400 let modified_lines = []
99 0.000494 for hunk in a:hunks
27 0.006799 0.000369 call extend(modified_lines, diff#process_hunk(hunk))
27 0.000039 endfor
72 0.000129 return modified_lines
FUNCTION diff#process_modified_and_added()
Called 1 time
Total time: 0.000121
Self time: 0.000121
count total (s) self (s)
1 0.000005 let offset = 0
2 0.000014 while offset < a:from_count
1 0.000006 let line_number = a:to_line + offset
1 0.000022 call add(a:modifications, [line_number, 'modified'])
1 0.000008 let offset += 1
1 0.000002 endwhile
2 0.000005 while offset < a:to_count
1 0.000004 let line_number = a:to_line + offset
1 0.000015 call add(a:modifications, [line_number, 'added'])
1 0.000007 let offset += 1
1 0.000001 endwhile
FUNCTION TabGuiCaptionLabel()
Called 56 times
Total time: 0.006924
Self time: 0.006924
count total (s) self (s)
56 0.000146 let caption = '['
56 0.000103 let tab_number = v:lnum
56 0.000263 let bufnrlist = tabpagebuflist(tab_number)
56 0.000377 let tab_name = gettabwinvar(tab_number, 1, 'tab_win_name')
56 0.000163 let caption .= tab_number
704 0.000688 for bufnr in bufnrlist
648 0.001899 if getbufvar(bufnr, "&modified")
let caption .= '+'
break
endif
648 0.000320 endfor
56 0.000103 let caption .= '] '
56 0.000142 let winnr = tabpagewinnr(tab_number)
56 0.000275 let buf_name = bufname(bufnrlist[winnr - 1])
56 0.000104 if tab_name == ''
let caption .= pathshorten(buf_name)
else
56 0.000109 let caption .= tab_name
56 0.000034 endif
56 0.000060 return caption
FUNCTION utility#highlight_name_for_change()
Called 80 times
Total time: 0.000499
Self time: 0.000499
count total (s) self (s)
80 0.000192 if a:text ==# 'added'
60 0.000081 return 'GitGutterLineAdded'
elseif a:text ==# 'removed'
2 0.000004 return 'GitGutterLineRemoved'
elseif a:text ==# 'modified'
18 0.000024 return 'GitGutterLineModified'
elseif a:text ==# 'modified_removed'
return 'GitGutterLineModifiedRemoved'
endif
FUNCTION utility#save_last_seen_change()
Called 72 times
Total time: 0.035589
Self time: 0.035589
count total (s) self (s)
72 0.035405 call setbufvar(a:file, 'gitgutter_last_tick', getbufvar(a:file, 'changedtick'))
FUNCTION <SNR>103_MarkMatch()
Called 486 times
Total time: 0.016700
Self time: 0.016700
count total (s) self (s)
486 0.001426 if ! exists('w:mwMatch')
let w:mwMatch = repeat([0], s:markNum)
endif
972 0.001335 for l:index in a:indices
486 0.001009 if w:mwMatch[l:index] > 0
silent! call matchdelete(w:mwMatch[l:index])
let w:mwMatch[l:index] = 0
endif
486 0.000289 endfor
486 0.000795 if ! empty(a:expr)
let l:index = a:indices[0] " Can only set one index for now.
" Info: matchadd() does not consider the 'magic' (it's always on),
" 'ignorecase' and 'smartcase' settings.
" Make the match according to the 'ignorecase' setting, like the star command.
" (But honor an explicit case-sensitive regexp via the /\C/ atom.)
let l:expr = ((&ignorecase && a:expr !~# '\\\@<!\\C') ? '\c' . a:expr : a:expr)
" To avoid an arbitrary ordering of highlightings, we assign a different
" priority based on the highlighting group, and ensure that the highest
" priority is -10, so that we do not override the 'hlsearch' of 0, and still
" allow other custom highlightings to sneak in between.
let l:priority = -10 - s:markNum + 1 + l:index
let w:mwMatch[l:index] = matchadd('MarkWord' . (l:index + 1), l:expr, l:priority)
endif
FUNCTION <SNR>64_LocalBrowse()
Called 7 times
Total time: 0.000305
Self time: 0.000305
count total (s) self (s)
" unfortunate interaction -- debugging calls can't be used here;
" the BufEnter event causes triggering when attempts to write to
" the DBG buffer are made.
7 0.000027 if !exists("s:vimentered")
return
endif
" call Decho("s:LocalBrowse(dirname<".a:dirname.">){")
" echomsg "dirname<".a:dirname.">"
7 0.000032 if has("amiga")
" The check against '' is made for the Amiga, where the empty
" string is the current directory and not checking would break
" things such as the help command.
" call Decho("(LocalBrowse) dirname<".a:dirname."> (amiga)")
if a:dirname != '' && isdirectory(a:dirname)
sil! call netrw#LocalBrowseCheck(a:dirname)
endif
elseif isdirectory(a:dirname)
" echomsg "dirname<".dirname."> isdir"
" call Decho("(LocalBrowse) dirname<".a:dirname."> (not amiga)")
sil! call netrw#LocalBrowseCheck(a:dirname)
endif
" not a directory, ignore it
" call Decho("|return s:LocalBrowse }")
FUNCTION diff#parse_hunk()
Called 27 times
Total time: 0.003613
Self time: 0.003613
count total (s) self (s)
27 0.002010 let matches = matchlist(a:line, s:hunk_re)
27 0.000156 if len(matches) > 0
27 0.000251 let from_line = str2nr(matches[1])
27 0.000199 let from_count = (matches[2] == '') ? 1 : str2nr(matches[2])
27 0.000183 let to_line = str2nr(matches[3])
27 0.000192 let to_count = (matches[4] == '') ? 1 : str2nr(matches[4])
27 0.000326 return [from_line, from_count, to_line, to_count]
else
return []
end
FUNCTION sign#upsert_new_gitgutter_signs()
Called 72 times
Total time: 0.043597
Self time: 0.043098
count total (s) self (s)
72 0.019458 let other_signs = getbufvar(a:file_name, 'gitgutter_other_signs')
72 0.018564 let old_gitgutter_signs = getbufvar(a:file_name, 'gitgutter_gitgutter_signs')
152 0.000275 for line in a:modified_lines
80 0.000202 let line_number = line[0]
80 0.000209 if index(other_signs, line_number) == -1 " don't clobber others' signs
80 0.001017 0.000518 let name = utility#highlight_name_for_change(line[1])
80 0.000254 if !has_key(old_gitgutter_signs, line_number) " insert
let id = sign#next_sign_id()
execute "sign place" id "line=" . line_number "name=" . name "file=" . a:file_name
else " update if sign has changed
80 0.000235 let old_sign = old_gitgutter_signs[line_number]
80 0.000180 if old_sign.name !=# name
execute "sign place" old_sign.id "name=" . old_sign.name "file=" . a:file_name
end
80 0.000047 endif
80 0.000042 endif
80 0.000051 endfor
" At this point b:gitgutter_gitgutter_signs is out of date.
FUNCTION <SNR>21_updateBufTimes()
Called 7 times
Total time: 0.000123
Self time: 0.000123
count total (s) self (s)
7 0.000102 let s:bufTimes[bufnr('%')] = localtime()
FUNCTION diff#process_modified()
Called 16 times
Total time: 0.000739
Self time: 0.000739
count total (s) self (s)
16 0.000071 let offset = 0
33 0.000123 while offset < a:to_count
17 0.000088 let line_number = a:to_line + offset
17 0.000139 call add(a:modifications, [line_number, 'modified'])
17 0.000050 let offset += 1
17 0.000023 endwhile
FUNCTION <SNR>56_BEActivateBuffer()
Called 7 times
Total time: 0.001802
Self time: 0.000815
count total (s) self (s)
7 0.000041 let b = bufnr("%")
7 0.000053 let l = get(s:tabSpace, tabpagenr(), [])
7 0.000332 0.000070 if s:BEIgnoreBuffer(b) == 1
return
endif
7 0.000023 if !empty(l) && l[0] == '-1'
" The first time we add a tab Vim uses the current
" buffer as it's starting page, even though we are about
" to edit a new page (BufEnter triggers after), so
" remove the -1 entry indicating we have covered this case.
let l = []
let s:tabSpace[tabpagenr()] = l
elseif empty(l) || index(l, b) == -1
" Add new buffer to this tab buffer list
let l = add(l, b)
let s:tabSpace[tabpagenr()] = l
if g:bufExplorerOnlyOneTab == 1
" If a buffer can only be available in 1 tab page
" ensure this buffer is not present in any other tabs
let tabidx = 1
while tabidx < len(s:tabSpace)
if tabidx != tabpagenr()
let bufidx = index(s:tabSpace[tabidx], b)
if bufidx != -1
call remove(s:tabSpace[tabidx], bufidx)
endif
endif
let tabidx = tabidx + 1
endwhile
endif
endif
7 0.000763 0.000038 call s:BEMRUPush(b)
7 0.000052 if exists('s:raw_buffer_listing') && !empty(s:raw_buffer_listing)
" Check if the buffer exists, but was deleted previously
" Careful use of ' and " so we do not have to escape all the \'s
" Regex: ^\s*bu\>
" ^ - Starting at the beginning of the string
" \s* - optional whitespace
" b - Vim's buffer number
" u\> - the buffer must be unlisted
7 0.000214 let shortlist = filter(copy(s:raw_buffer_listing), "v:val.attributes =~ '".'^\s*'.b.'u\>'."'")
7 0.000016 if !empty(shortlist)
" If it is unlisted (ie deleted), but now we editing it again
" rebuild the buffer list.
let s:refreshBufferList = 1
endif
7 0.000003 endif
FUNCTION sign#update_signs()
Called 72 times
Total time: 0.152967
Self time: 0.003880
count total (s) self (s)
72 0.074721 0.001011 call sign#find_current_signs(a:file_name)
72 0.000706 let new_gitgutter_signs_line_numbers = map(copy(a:modified_lines), 'v:val[0]')
72 0.032685 0.000905 call sign#remove_obsolete_gitgutter_signs(a:file_name, new_gitgutter_signs_line_numbers)
72 0.044183 0.000586 call sign#upsert_new_gitgutter_signs(a:file_name, a:modified_lines)
FUNCTION <SNR>63_Highlight_Matching_Pair()
Called 16 times
Total time: 0.001751
Self time: 0.001751
count total (s) self (s)
" Remove any previous match.
16 0.000123 if exists('w:paren_hl_on') && w:paren_hl_on
3match none
let w:paren_hl_on = 0
endif
" Avoid that we remove the popup menu.
" Return when there are no colors (looks like the cursor jumps).
16 0.000106 if pumvisible() || (&t_Co < 8 && !has("gui_running"))
return
endif
" Get the character under the cursor and check if it's in 'matchpairs'.
16 0.000076 let c_lnum = line('.')
16 0.000057 let c_col = col('.')
16 0.000034 let before = 0
16 0.000111 let c = getline(c_lnum)[c_col - 1]
16 0.000528 let plist = split(&matchpairs, '.\zs[:,]')
16 0.000085 let i = index(plist, c)
16 0.000032 if i < 0
" not found, in Insert mode try character before the cursor
16 0.000074 if c_col > 1 && (mode() == 'i' || mode() == 'R')
let before = 1
let c = getline(c_lnum)[c_col - 2]
let i = index(plist, c)
endif
16 0.000020 if i < 0
" not found, nothing to do
16 0.000031 return
endif
endif
" Figure out the arguments for searchpairpos().
if i % 2 == 0
let s_flags = 'nW'
let c2 = plist[i + 1]
else
let s_flags = 'nbW'
let c2 = c
let c = plist[i - 1]
endif
if c == '['
let c = '\['
let c2 = '\]'
endif
" Find the match. When it was just before the cursor move it there for a
" moment.
if before > 0
let save_cursor = winsaveview()
call cursor(c_lnum, c_col - before)
endif
" When not in a string or comment ignore matches inside them.
" We match "escape" for special items, such as lispEscapeSpecial.
let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' . '=~? "string\\|character\\|singlequote\\|escape\\|comment"'
execute 'if' s_skip '| let s_skip = 0 | endif'
" Limit the search to lines visible in the window.
let stoplinebottom = line('w$')
let stoplinetop = line('w0')
if i % 2 == 0
let stopline = stoplinebottom
else
let stopline = stoplinetop
endif
" Limit the search time to 300 msec to avoid a hang on very long lines.
" This fails when a timeout is not supported.
if mode() == 'i' || mode() == 'R'
let timeout = exists("b:matchparen_insert_timeout") ? b:matchparen_insert_timeout : g:matchparen_insert_timeout
else
let timeout = exists("b:matchparen_timeout") ? b:matchparen_timeout : g:matchparen_timeout
endif
try
let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, timeout)
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
if before > 0
call winrestview(save_cursor)
endif
" If a match is found setup match highlighting.
if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom
exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) . 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/'
let w:paren_hl_on = 1
endif
FUNCTION utility#file()
Called 455 times
Total time: 0.003018
Self time: 0.003018
count total (s) self (s)
455 0.001883 return s:file
FUNCTION utility#is_tracked_by_git()
Called 78 times
Total time: 2.049634
Self time: 0.020561
count total (s) self (s)
78 0.007385 0.001733 let cmd = utility#escape('git ls-files --error-unmatch' . utility#discard_stdout_and_stderr() . ' ' . shellescape(utility#file()))
78 2.039560 0.016139 call system(utility#command_in_directory_of_file(cmd))
78 0.001262 return !v:shell_error
FUNCTION sign#remove_dummy_sign()
Called 60 times
Total time: 0.242514
Self time: 0.241656
count total (s) self (s)
60 0.000539 if exists('s:dummy_sign_id')
60 0.241292 0.240434 execute "sign unplace" s:dummy_sign_id "file=" . utility#file()
60 0.000168 endif
FUNCTION diff#is_modified_and_added()
Called 1 time
Total time: 0.000007
Self time: 0.000007
count total (s) self (s)
1 0.000006 return a:from_count > 0 && a:to_count > 0 && a:from_count < a:to_count
FUNCTION utility#set_file()
Called 83 times
Total time: 0.001119
Self time: 0.001119
count total (s) self (s)
83 0.000760 let s:file = a:file
FUNCTION diff#process_hunk()
Called 27 times
Total time: 0.006430
Self time: 0.003418
count total (s) self (s)
27 0.000147 let modifications = []
27 0.000130 let from_line = a:hunk[0]
27 0.000096 let from_count = a:hunk[1]
27 0.000090 let to_line = a:hunk[2]
27 0.000096 let to_count = a:hunk[3]
27 0.000559 0.000344 if diff#is_added(from_count, to_count)
8 0.001437 0.000082 call diff#process_added(modifications, from_count, to_count, to_line)
8 0.000122 0.000060 call hunk#increment_lines_added(to_count)
8 0.000028 elseif diff#is_removed(from_count, to_count)
2 0.000172 0.000142 call diff#process_removed(modifications, from_count, to_count, to_line)
2 0.000049 0.000028 call hunk#increment_lines_removed(from_count)
2 0.000008 elseif diff#is_modified(from_count, to_count)
16 0.000909 0.000170 call diff#process_modified(modifications, from_count, to_count, to_line)
16 0.000284 0.000122 call hunk#increment_lines_modified(to_count)
16 0.000059 elseif diff#is_modified_and_added(from_count, to_count)
1 0.000169 0.000048 call diff#process_modified_and_added(modifications, from_count, to_count, to_line)
1 0.000046 0.000032 call hunk#increment_lines_added(to_count - from_count)
1 0.000040 0.000032 call hunk#increment_lines_modified(from_count)
1 0.000005 elseif diff#is_modified_and_removed(from_count, to_count)
call diff#process_modified_and_removed(modifications, from_count, to_count, to_line)
call hunk#increment_lines_modified(to_count)
call hunk#increment_lines_removed(from_count - to_count)
endif
27 0.000047 return modifications
FUNCTION utility#differences()
Called 72 times
Total time: 0.000962
Self time: 0.000962
count total (s) self (s)
72 0.000551 return len(a:hunks) != 0
FUNCTION hunk#reset()
Called 83 times
Total time: 0.003417
Self time: 0.003417
count total (s) self (s)
83 0.002811 let s:summary = [0, 0, 0] " TODO: is bling/airline expecting [-1, -1, -1]?
FUNCTION hunk#increment_lines_modified()
Called 17 times
Total time: 0.000170
Self time: 0.000170
count total (s) self (s)
17 0.000104 let s:summary[1] += a:count
FUNCTION diff#run_diff()
Called 72 times
Total time: 1.879334
Self time: 0.026999
count total (s) self (s)
72 0.000420 if a:realtime
let blob_name = ':./' . fnamemodify(utility#file(),':t')
let blob_file = tempname()
let cmd = 'git show ' . blob_name . ' > ' . blob_file . ' && diff -U0 ' . g:gitgutter_diff_args . ' ' . blob_file . ' - '
else
72 0.002163 0.001334 let cmd = 'git diff --no-ext-diff --no-color -U0 ' . g:gitgutter_diff_args . ' ' . shellescape(utility#file())
72 0.000099 endif
72 0.000212 if a:use_external_grep && s:grep_available
72 0.000666 let cmd .= s:grep_command
72 0.000068 endif
72 0.007232 0.000847 let cmd = utility#escape(cmd)
72 0.000152 if a:realtime
if &fileformat ==# "dos"
let eol = "\r\n"
elseif &fileformat ==# "mac"
let eol = "\r"
else
let eol = "\n"
endif
let buffer_contents = join(getline(1, '$'), eol) . eol
let diff = system(utility#command_in_directory_of_file(cmd), buffer_contents)
else
72 1.863188 0.018067 let diff = system(utility#command_in_directory_of_file(cmd))
72 0.000590 endif
72 0.000667 return diff
FUNCTION <SNR>56_BEIgnoreBuffer()
Called 14 times
Total time: 0.000483
Self time: 0.000483
count total (s) self (s)
" Check to see if this buffer should be ignore by BufExplorer.
" Skip temporary buffers with buftype set.
14 0.000086 if empty(getbufvar(a:buf, "&buftype") == 0)
return 1
endif
" Skip unlisted buffers.
14 0.000028 if buflisted(a:buf) == 0
return 1
endif
" Skip buffers with no name.
14 0.000039 if empty(bufname(a:buf)) == 1
return 1
endif
" Do not add the BufExplorer window to the list.
14 0.000061 if fnamemodify(bufname(a:buf), ":t") == s:name
call s:BEError("The buffer name was [".s:name."] so it was skipped.")
return 1
endif
14 0.000050 if index(s:MRU_Exclude_List, bufname(a:buf)) >= 0
return 1
end
14 0.000008 return 0
FUNCTION diff#parse_diff()
Called 72 times
Total time: 0.012602
Self time: 0.008989
count total (s) self (s)
72 0.001171 let hunks = []
99 0.004321 for line in split(a:diff, '\n')
27 0.004107 0.000494 let hunk_info = diff#parse_hunk(line)
27 0.000096 if len(hunk_info) == 4
27 0.000128 call add(hunks, hunk_info)
27 0.000034 endif
27 0.000099 endfor
72 0.000155 return hunks
FUNCTION <SNR>56_BEMRUPush()
Called 7 times
Total time: 0.000725
Self time: 0.000153
count total (s) self (s)
7 0.000271 0.000050 if s:BEIgnoreBuffer(a:buf) == 1
return
endif
" Remove the buffer number from the list if it already exists.
7 0.000387 0.000036 call s:BEMRUPop(a:buf)
" Add the buffer number to the head of the list.
7 0.000038 call insert(s:MRUList,a:buf)
FUNCTION mark#UpdateScope()
Called 7 times
Total time: 0.034601
Self time: 0.009185
count total (s) self (s)
7 0.000046 let l:currentWinNr = winnr()
" By entering a window, its height is potentially increased from 0 to 1 (the
" minimum for the current window). To avoid any modification, save the window
" sizes and restore them after visiting all windows.
7 0.000151 let l:originalWindowLayout = winrestcmd()
7 0.033686 0.008270 noautocmd windo call mark#UpdateMark()
7 0.000446 execute l:currentWinNr . 'wincmd w'
7 0.000208 silent! execute l:originalWindowLayout
FUNCTION diff#is_removed()
Called 19 times
Total time: 0.000166
Self time: 0.000166
count total (s) self (s)
19 0.000100 return a:from_count > 0 && a:to_count == 0
FUNCTION utility#is_active()
Called 83 times
Total time: 2.057456
Self time: 0.004792
count total (s) self (s)
83 2.056963 0.004299 return g:gitgutter_enabled && utility#exists_file() && utility#is_tracked_by_git()
FUNCTION sign#add_dummy_sign()
Called 12 times
Total time: 0.005447
Self time: 0.005288
count total (s) self (s)
12 0.005370 0.005211 execute "sign place" s:dummy_sign_id "line=" . 9999 "name=GitGutterDummy file=" . utility#file()
FUNCTION diff#process_added()
Called 8 times
Total time: 0.001355
Self time: 0.001355
count total (s) self (s)
8 0.000039 let offset = 0
67 0.000158 while offset < a:to_count
59 0.000229 let line_number = a:to_line + offset
59 0.000534 call add(a:modifications, [line_number, 'added'])
59 0.000144 let offset += 1
59 0.000075 endwhile
FUNCTION sign#remove_obsolete_gitgutter_signs()
Called 72 times
Total time: 0.031780
Self time: 0.031780
count total (s) self (s)
72 0.020920 let old_gitgutter_signs = getbufvar(a:file_name, 'gitgutter_gitgutter_signs')
155 0.000572 for line_number in keys(old_gitgutter_signs)
83 0.000403 if index(a:new_gitgutter_signs_line_numbers, str2nr(line_number)) == -1
3 0.008482 execute "sign unplace" old_gitgutter_signs[line_number].id
3 0.000009 endif
83 0.000061 endfor
FUNCTION utility#command_in_directory_of_file()
Called 150 times
Total time: 0.010795
Self time: 0.006072
count total (s) self (s)
150 0.007050 0.002327 let utility#cmd_in_dir = 'cd ' . utility#directory_of_file() . ' && ' . a:cmd
150 0.002933 return substitute(utility#cmd_in_dir, "'", '"', 'g')
FUNCTION hunk#increment_lines_added()
Called 9 times
Total time: 0.000076
Self time: 0.000076
count total (s) self (s)
9 0.000048 let s:summary[0] += a:count
FUNCTION utility#has_unsaved_changes()
Called 72 times
Total time: 0.030045
Self time: 0.030045
count total (s) self (s)
72 0.029374 return getbufvar(a:file, "&mod")
FUNCTION <SNR>124_LocalBrowseShellCmdRefresh()
Called 1 time
Total time: 0.000026
Self time: 0.000026
count total (s) self (s)
" call Dfunc("LocalBrowseShellCmdRefresh() browselist=".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "empty")." ".tabpagenr("$")." tabs")
" determine which buffers currently reside in a tab
1 0.000009 if !exists("s:netrw_browselist")
" call Dret("LocalBrowseShellCmdRefresh : browselist is empty")
return
endif
1 0.000004 if !exists("w:netrw_bannercnt")
" call Dret("LocalBrowseShellCmdRefresh : don't refresh when focus not on netrw window")
1 0.000001 return
endif
if exists("s:locbrowseshellcmd")
if s:locbrowseshellcmd
let s:locbrowseshellcmd= 0
" call Dret("LocalBrowseShellCmdRefresh : NetrwBrowse itself caused the refresh")
return
endif
let s:locbrowseshellcmd= 0
endif
let itab = 1
let buftablist = []
let ykeep = @@
while itab <= tabpagenr("$")
let buftablist = buftablist + tabpagebuflist()
let itab = itab + 1
tabn
endwhile
" call Decho("buftablist".string(buftablist))
" call Decho("s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">")
" GO through all buffers on netrw_browselist (ie. just local-netrw buffers):
" | refresh any netrw window
" | wipe out any non-displaying netrw buffer
let curwin = winnr()
let ibl = 0
for ibuf in s:netrw_browselist
" call Decho("bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf))
if bufwinnr(ibuf) == -1 && index(buftablist,ibuf) == -1
" wipe out any non-displaying netrw buffer
" call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">")
exe "sil! bd ".fnameescape(ibuf)
call remove(s:netrw_browselist,ibl)
" call Decho("browselist=".string(s:netrw_browselist))
continue
elseif index(tabpagebuflist(),ibuf) != -1
" refresh any netrw buffer
" call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf))
exe bufwinnr(ibuf)."wincmd w"
keepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
endif
let ibl= ibl + 1
endfor
exe curwin."wincmd w"
let @@= ykeep
" call Dret("LocalBrowseShellCmdRefresh")
FUNCTION GitGutterAll()
Called 8 times
Total time: 4.463421
Self time: 0.009728
count total (s) self (s)
91 0.000851 for buffer_id in tabpagebuflist()
83 0.004784 let file = expand('#' . buffer_id . ':p')
83 0.000328 if !empty(file)
83 4.456412 0.002719 call GitGutter(file, 0)
83 0.000192 endif
83 0.000235 endfor
FUNCTION utility#directory_of_file()
Called 150 times
Total time: 0.004723
Self time: 0.004035
count total (s) self (s)
150 0.004119 0.003431 return shellescape(fnamemodify(utility#file(), ':h'))
FUNCTION mark#UpdateMark()
Called 81 times
Total time: 0.025416
Self time: 0.008716
count total (s) self (s)
81 0.000218 let i = 0
567 0.000747 while i < s:markNum
486 0.001512 if ! s:enabled || empty(s:pattern[i])
486 0.019080 0.002380 call s:MarkMatch([i], '')
486 0.000293 else
call s:MarkMatch([i], s:pattern[i])
endif
486 0.000593 let i += 1
486 0.000319 endwhile
FUNCTION utility#exists_file()
Called 83 times
Total time: 0.003030
Self time: 0.002722
count total (s) self (s)
83 0.002638 0.002330 return filereadable(utility#file())
FUNCTION fugitive#reload_status()
Called 1 time
Total time: 0.003531
Self time: 0.003531
count total (s) self (s)
1 0.000012 if exists('s:reloading_status')
return
endif
1 0.000002 try
1 0.000012 let s:reloading_status = 1
1 0.000006 let mytab = tabpagenr()
9 0.000031 for tab in [mytab] + range(1,tabpagenr('$'))
91 0.000213 for winnr in range(1,tabpagewinnr(tab,'$'))
83 0.001067 if getbufvar(tabpagebuflist(tab)[winnr-1],'fugitive_type') ==# 'index'
execute 'tabnext '.tab
if winnr != winnr()
execute winnr.'wincmd w'
let restorewinnr = 1
endif
try
if !&modified
call s:BufReadIndex()
endif
finally
if exists('restorewinnr')
wincmd p
endif
execute 'tabnext '.mytab
endtry
endif
83 0.000074 endfor
8 0.000008 endfor
1 0.000002 finally
1 0.000004 unlet! s:reloading_status
1 0.000001 endtry
FUNCTION utility#discard_stdout_and_stderr()
Called 78 times
Total time: 0.002084
Self time: 0.002084
count total (s) self (s)
78 0.000622 if !exists('utility#discard')
78 0.000318 if &shellredir ==? '>%s 2>&1'
78 0.000233 let utility#discard = ' > /dev/null 2>&1'
78 0.000075 else
let utility#discard = ' >& /dev/null'
endif
78 0.000048 endif
78 0.000158 return utility#discard
FUNCTION GitGutter()
Called 83 times
Total time: 4.453693
Self time: 0.022091
count total (s) self (s)
83 0.001784 0.000665 call utility#set_file(a:file)
83 2.059549 0.002093 if utility#is_active()
72 0.000575 if !a:realtime || utility#has_fresh_changes(a:file)
72 1.915872 0.006493 let diff = diff#run_diff(a:realtime || utility#has_unsaved_changes(a:file), 1)
72 0.016316 0.003714 let s:hunks = diff#parse_diff(diff)
72 0.013908 0.000712 let modified_lines = diff#process_hunks(s:hunks)
72 0.000169 if g:gitgutter_signs
72 0.000157 if g:gitgutter_sign_column_always
call sign#add_dummy_sign()
else
72 0.001476 0.000514 if utility#differences(s:hunks)
12 0.005586 0.000139 call sign#add_dummy_sign() " prevent flicker
12 0.000033 else
60 0.243125 0.000611 call sign#remove_dummy_sign()
60 0.000059 endif
72 0.000045 endif
72 0.154716 0.001749 call sign#update_signs(a:file, modified_lines)
72 0.000067 endif
72 0.036070 0.000481 call utility#save_last_seen_change(a:file)
72 0.000083 endif
72 0.000040 else
11 0.000541 0.000170 call hunk#reset()
11 0.000013 endif
FUNCTION hunk#increment_lines_removed()
Called 2 times
Total time: 0.000021
Self time: 0.000021
count total (s) self (s)
2 0.000014 let s:summary[2] += a:count
FUNCTION <SNR>56_BEMRUPop()
Called 7 times
Total time: 0.000351
Self time: 0.000351
count total (s) self (s)
7 0.000338 call filter(s:MRUList, 'v:val != '.a:buf)
FUNCTION diff#is_added()
Called 27 times
Total time: 0.000215
Self time: 0.000215
count total (s) self (s)
27 0.000128 return a:from_count == 0 && a:to_count > 0
FUNCTION diff#process_removed()
Called 2 times
Total time: 0.000030
Self time: 0.000030
count total (s) self (s)
2 0.000026 call add(a:modifications, [a:to_line, 'removed'])
FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
8 4.463421 0.009728 GitGutterAll()
83 4.453693 0.022091 GitGutter()
83 2.057456 0.004792 utility#is_active()
78 2.049634 0.020561 utility#is_tracked_by_git()
72 1.879334 0.026999 diff#run_diff()
60 0.242514 0.241656 sign#remove_dummy_sign()
72 0.152967 0.003880 sign#update_signs()
72 0.073710 sign#find_current_signs()
72 0.043597 0.043098 sign#upsert_new_gitgutter_signs()
72 0.035589 utility#save_last_seen_change()
7 0.034601 0.009185 mark#UpdateScope()
72 0.031780 sign#remove_obsolete_gitgutter_signs()
72 0.030045 utility#has_unsaved_changes()
81 0.025416 0.008716 mark#UpdateMark()
486 0.016700 <SNR>103_MarkMatch()
72 0.013196 0.003720 diff#process_hunks()
72 0.012602 0.008989 diff#parse_diff()
150 0.010795 0.006072 utility#command_in_directory_of_file()
150 0.009777 utility#escape()
56 0.006924 TabGuiCaptionLabel()
FUNCTIONS SORTED ON SELF TIME
count total (s) self (s) function
60 0.242514 0.241656 sign#remove_dummy_sign()
72 0.073710 sign#find_current_signs()
72 0.043597 0.043098 sign#upsert_new_gitgutter_signs()
72 0.035589 utility#save_last_seen_change()
72 0.031780 sign#remove_obsolete_gitgutter_signs()
72 0.030045 utility#has_unsaved_changes()
72 1.879334 0.026999 diff#run_diff()
83 4.453693 0.022091 GitGutter()
78 2.049634 0.020561 utility#is_tracked_by_git()
486 0.016700 <SNR>103_MarkMatch()
150 0.009777 utility#escape()
8 4.463421 0.009728 GitGutterAll()
7 0.034601 0.009185 mark#UpdateScope()
72 0.012602 0.008989 diff#parse_diff()
81 0.025416 0.008716 mark#UpdateMark()
56 0.006924 TabGuiCaptionLabel()
150 0.010795 0.006072 utility#command_in_directory_of_file()
12 0.005447 0.005288 sign#add_dummy_sign()
83 2.057456 0.004792 utility#is_active()
150 0.004723 0.004035 utility#directory_of_file()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment