Skip to content

Instantly share code, notes, and snippets.

@fgarcia
Created January 16, 2014 11:31
Show Gist options
  • Select an option

  • Save fgarcia/8453415 to your computer and use it in GitHub Desktop.

Select an option

Save fgarcia/8453415 to your computer and use it in GitHub Desktop.
FUNCTION neosnippet#init#_initialize()
Called 1 time
Total time: 2.880206
Self time: 0.000110
count total (s) self (s)
1 0.000004 let s:is_initialized = 1
1 0.529526 0.000067 call s:initialize_script_variables()
1 0.012750 0.000016 call s:initialize_others()
1 2.337917 0.000014 call s:initialize_cache()
FUNCTION neosnippet#helpers#get_filetype()
Called 2 times
Total time: 0.000882
Self time: 0.000869
count total (s) self (s)
2 0.000012 if !exists('s:exists_context_filetype')
" context_filetype.vim installation check.
1 0.000002 try
1 0.000785 0.000772 call context_filetype#version()
let s:exists_context_filetype = 1
catch
1 0.000004 let s:exists_context_filetype = 0
1 0.000003 endtry
1 0.000001 endif
2 0.000013 let context_filetype = s:exists_context_filetype ? context_filetype#get_filetype() : &filetype
2 0.000006 if context_filetype == ''
let context_filetype = 'nothing'
endif
2 0.000004 return context_filetype
FUNCTION neosnippet#variables#snippets_dir()
Called 3 times
Total time: 0.000049
Self time: 0.000049
count total (s) self (s)
3 0.000022 if !exists('s:snippets_dir')
1 0.000003 let s:snippets_dir = []
1 0.000001 endif
3 0.000006 return s:snippets_dir
FUNCTION neosnippet#util#option2list()
Called 1 time
Total time: 0.000014
Self time: 0.000014
count total (s) self (s)
1 0.000014 return type(a:str) == type('') ? split(a:str, '\s*,\s*') : a:str
FUNCTION neosnippet#commands#_make_cache()
Called 2 times
Total time: 2.336229
Self time: 0.005126
count total (s) self (s)
2 0.000039 0.000016 call neosnippet#init#check()
2 0.000011 let filetype = a:filetype == '' ? &filetype : a:filetype
2 0.000005 if filetype ==# ''
let filetype = 'nothing'
endif
2 0.000036 0.000012 let snippets = neosnippet#variables#snippets()
2 0.000008 if has_key(snippets, filetype)
return
endif
2 0.002293 0.000643 let path = join(neosnippet#helpers#get_snippets_directory(), ',')
2 0.000006 let snippets_files = []
6 0.011071 0.000119 for glob in s:get_list().flatten( map(split(get(g:neosnippet#scope_aliases, filetype, filetype), '\s*,\s*'), " [v:val . '.snip*', v:val . '/**/*.snip*'] + (filetype != '_' && !has_key(g:neosnippet#scope_aliases, filetype) ? [v:val . '_*.snip*'] : [])"))
4 2.277361 0.003176 let snippets_files += split(globpath(path, glob), '\n')
4 0.000037 endfor
2 0.000011 let snippet = {}
2 0.045226 0.000978 call map(reverse(s:get_list().uniq(snippets_files)), "neosnippet#parser#_parse(snippet, v:val)")
2 0.000043 0.000022 let snippets = neosnippet#variables#snippets()
2 0.000009 let snippets[filetype] = snippet
FUNCTION neosnippet#variables#snippets()
Called 4 times
Total time: 0.000045
Self time: 0.000045
count total (s) self (s)
4 0.000016 if !exists('s:snippets')
1 0.000005 let s:snippets= {}
1 0.000001 endif
4 0.000006 return s:snippets
FUNCTION neosnippet#helpers#get_snippets_directory()
Called 2 times
Total time: 0.001028
Self time: 0.000088
count total (s) self (s)
2 0.000065 0.000027 let snippets_dir = copy(neosnippet#variables#snippets_dir())
2 0.000915 0.000033 if !get(g:neosnippet#disable_runtime_snippets, neosnippet#helpers#get_filetype(), get(g:neosnippet#disable_runtime_snippets, '_', 0))
2 0.000037 0.000017 let snippets_dir += neosnippet#variables#runtime_dir()
2 0.000002 endif
2 0.000003 return snippets_dir
FUNCTION neosnippet#get_placeholder_marker_pattern()
Called 25 times
Total time: 0.000093
Self time: 0.000093
count total (s) self (s)
25 0.000058 return '<`\d\+\%(:.\{-}\)\?\\\@<!`>'
FUNCTION neosnippet#parser#_initialize_snippet_options()
Called 36 times
Total time: 0.000222
Self time: 0.000222
count total (s) self (s)
36 0.000192 return { 'head' : 0, 'word' : 0, 'indent' : 0 }
FUNCTION neosnippet#util#set_default()
Called 5 times
Total time: 0.000078
Self time: 0.000078
count total (s) self (s)
5 0.000033 if !exists(a:var)
3 0.000022 let {a:var} = a:val
3 0.000005 endif
FUNCTION neosnippet#mappings#_clear_select_mode_mappings()
Called 1 time
Total time: 0.010256
Self time: 0.010256
count total (s) self (s)
1 0.000004 if !g:neosnippet#disable_select_mode_mappings
return
endif
1 0.000005 redir => mappings
1 0.001074 silent! smap
1 0.000023 redir END
206 0.001854 for line in map(filter(split(mappings, '\n'), "v:val !~# '^s'"), "substitute(v:val, '<NL>', '<C-J>', 'g')")
205 0.001786 let map = matchstr(line, '^\a*\s*\zs\S\+')
205 0.001216 let map = substitute(map, '<NL>', '<C-j>', 'g')
205 0.002087 silent! execute 'sunmap' map
205 0.001806 silent! execute 'sunmap <buffer>' map
205 0.000165 endfor
" Define default select mode mappings.
1 0.000009 snoremap <CR> a<BS>
1 0.000007 snoremap <BS> a<BS>
1 0.000007 snoremap <Del> a<BS>
1 0.000007 snoremap <C-h> a<BS>
FUNCTION neosnippet#parser#_parse()
Called 2 times
Total time: 0.043041
Self time: 0.026284
count total (s) self (s)
2 0.000011 let dup_check = {}
2 0.000006 let snippet_dict = {}
2 0.000005 let linenr = 1
2 0.000062 if !filereadable(a:snippets_file)
call neosnippet#util#print_error( printf('snippet file "%s" is not found.', a:snippets_file))
return a:snippets
endif
191 0.003471 for line in readfile(a:snippets_file)
189 0.001709 if line =~ '^\h\w*.*\s$'
" Delete spaces.
let line = substitute(line, '\s\+$', '', '')
endif
189 0.000871 if line =~ '^#'
" Ignore.
3 0.000004 elseif line =~ '^include'
" Include snippets.
let filename = matchstr(line, '^include\s\+\zs.*$')
for snippets_file in split(globpath(join( neosnippet#helpers#get_snippets_directory(), ','), filename), '\n')
call neosnippet#parser#_parse(a:snippets, snippets_file)
endfor
elseif line =~ '^delete\s'
let name = matchstr(line, '^delete\s\+\zs.*$')
if name != '' && has_key(a:snippets, name)
call filter(a:snippets, 'v:val.real_name !=# name')
endif
elseif line =~ '^snippet\s'
36 0.000119 if !empty(snippet_dict)
" Set previous snippet.
34 0.007377 0.000489 call s:set_snippet_dict(snippet_dict, a:snippets, dup_check, a:snippets_file)
34 0.000043 endif
36 0.004669 0.000581 let snippet_dict = s:parse_snippet_name( a:snippets_file, line, linenr, dup_check)
36 0.000098 elseif !empty(snippet_dict)
149 0.001051 if line =~ '^\s' || line == ''
104 0.000298 if snippet_dict.word == ''
" Substitute head tab character.
36 0.000318 let line = substitute(line, '^\t', '', '')
36 0.000046 endif
104 0.001234 let snippet_dict.word .= substitute(line, '^ *', '', '') . "\n"
104 0.000147 else
45 0.005997 0.000601 call s:add_snippet_attribute( a:snippets_file, line, linenr, snippet_dict)
45 0.000053 endif
149 0.000126 endif
189 0.000464 let linenr += 1
189 0.000236 endfor
2 0.000005 if !empty(snippet_dict)
" Set previous snippet.
2 0.000408 0.000023 call s:set_snippet_dict(snippet_dict, a:snippets, dup_check, a:snippets_file)
2 0.000002 endif
2 0.000003 return a:snippets
FUNCTION neosnippet#init#check()
Called 2 times
Total time: 0.000023
Self time: 0.000023
count total (s) self (s)
2 0.000011 if !exists('s:is_initialized')
call neosnippet#init#_initialize()
endif
FUNCTION neosnippet#util#expand()
Called 1 time
Total time: 0.508194
Self time: 0.000321
count total (s) self (s)
1 0.508192 0.000319 return neosnippet#util#substitute_path_separator( expand(escape(a:path, '*?[]"={}'), 1))
FUNCTION neosnippet#variables#runtime_dir()
Called 3 times
Total time: 0.000035
Self time: 0.000035
count total (s) self (s)
3 0.000014 if !exists('s:runtime_dir')
1 0.000002 let s:runtime_dir = []
1 0.000001 endif
3 0.000005 return s:runtime_dir
FUNCTION neosnippet#util#substitute_path_separator()
Called 1 time
Total time: 0.000048
Self time: 0.000035
count total (s) self (s)
1 0.000044 0.000031 return call(s:V.substitute_path_separator, a:000)
FUNCTION neosnippet#get_placeholder_marker_substitute_pattern()
Called 36 times
Total time: 0.000129
Self time: 0.000129
count total (s) self (s)
36 0.000099 return '\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}'
FUNCTION neosnippet#parser#_initialize_snippet()
Called 36 times
Total time: 0.005029
Self time: 0.004742
count total (s) self (s)
36 0.000498 let a:dict.word = substitute(a:dict.word, '\n\+$', '', '')
36 0.000948 0.000819 if a:dict.word !~ neosnippet#get_placeholder_marker_substitute_pattern()
" Add placeholder.
7 0.000029 let a:dict.word .= '${0}'
7 0.000009 endif
36 0.000112 let menu_prefix = '[nsnip] '
36 0.000190 if !has_key(a:dict, 'abbr') || a:dict.abbr == ''
" Set default abbr.
24 0.001398 0.001240 let abbr = substitute(a:dict.word, neosnippet#get_placeholder_marker_pattern(). '\|'. neosnippet#get_mirror_placeholder_marker_pattern(). '\|\s\+\|\n\|TARGET', ' ', 'g')
24 0.000088 let a:dict.abbr = a:dict.name
24 0.000029 else
12 0.000038 let abbr = a:dict.abbr
12 0.000014 endif
36 0.000718 let snippet = { 'word' : a:dict.name, 'snip' : a:dict.word, 'description' : a:dict.word, 'menu_template' : menu_prefix . abbr, 'menu_abbr' : abbr, 'options' : a:dict.options, 'action__path' : a:path, 'action__line' : a:line, 'action__pattern' : a:pattern, 'real_name' : a:name,}
36 0.000128 if has_key(a:dict, 'regexp')
let snippet.regexp = a:dict.regexp
endif
36 0.000061 return snippet
FUNCTION neosnippet#get_sync_placeholder_marker_pattern()
Called 1 time
Total time: 0.000003
Self time: 0.000003
count total (s) self (s)
1 0.000001 return '<{\d\+\%(:.\{-}\)\?\\\@<!}>'
FUNCTION neosnippet#get_mirror_placeholder_marker_pattern()
Called 25 times
Total time: 0.000070
Self time: 0.000070
count total (s) self (s)
25 0.000042 return '<|\d\+|>'
FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
1 2.880206 0.000110 neosnippet#init#_initialize()
2 2.336229 0.005126 neosnippet#commands#_make_cache()
1 0.508194 0.000321 neosnippet#util#expand()
2 0.043041 0.026284 neosnippet#parser#_parse()
1 0.010256 neosnippet#mappings#_clear_select_mode_mappings()
36 0.005029 0.004742 neosnippet#parser#_initialize_snippet()
2 0.001028 0.000088 neosnippet#helpers#get_snippets_directory()
2 0.000882 0.000869 neosnippet#helpers#get_filetype()
36 0.000222 neosnippet#parser#_initialize_snippet_options()
36 0.000129 neosnippet#get_placeholder_marker_substitute_pattern()
25 0.000093 neosnippet#get_placeholder_marker_pattern()
5 0.000078 neosnippet#util#set_default()
25 0.000070 neosnippet#get_mirror_placeholder_marker_pattern()
3 0.000049 neosnippet#variables#snippets_dir()
1 0.000048 0.000035 neosnippet#util#substitute_path_separator()
4 0.000045 neosnippet#variables#snippets()
3 0.000035 neosnippet#variables#runtime_dir()
2 0.000023 neosnippet#init#check()
1 0.000014 neosnippet#util#option2list()
1 0.000003 neosnippet#get_sync_placeholder_marker_pattern()
FUNCTIONS SORTED ON SELF TIME
count total (s) self (s) function
2 0.043041 0.026284 neosnippet#parser#_parse()
1 0.010256 neosnippet#mappings#_clear_select_mode_mappings()
2 2.336229 0.005126 neosnippet#commands#_make_cache()
36 0.005029 0.004742 neosnippet#parser#_initialize_snippet()
2 0.000882 0.000869 neosnippet#helpers#get_filetype()
1 0.508194 0.000321 neosnippet#util#expand()
36 0.000222 neosnippet#parser#_initialize_snippet_options()
36 0.000129 neosnippet#get_placeholder_marker_substitute_pattern()
1 2.880206 0.000110 neosnippet#init#_initialize()
25 0.000093 neosnippet#get_placeholder_marker_pattern()
2 0.001028 0.000088 neosnippet#helpers#get_snippets_directory()
5 0.000078 neosnippet#util#set_default()
25 0.000070 neosnippet#get_mirror_placeholder_marker_pattern()
3 0.000049 neosnippet#variables#snippets_dir()
4 0.000045 neosnippet#variables#snippets()
1 0.000048 0.000035 neosnippet#util#substitute_path_separator()
3 0.000035 neosnippet#variables#runtime_dir()
2 0.000023 neosnippet#init#check()
1 0.000014 neosnippet#util#option2list()
1 0.000003 neosnippet#get_sync_placeholder_marker_pattern()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment