Skip to content

Instantly share code, notes, and snippets.

@Shougo
Created June 18, 2010 10:14
Show Gist options
  • Save Shougo/443472 to your computer and use it in GitHub Desktop.
Save Shougo/443472 to your computer and use it in GitHub Desktop.
FUNCTION eskk#table#has_map()
Called 590 times
Total time: 0.019037
Self time: 0.004388
count total (s) self (s)
590 0.018447 0.003798 return has_key(s:get_table(a:table_name), a:lhs)
FUNCTION eskk#get_stl()
Called 16 times
Total time: 0.001060
Self time: 0.000390
count total (s) self (s)
16 0.000292 0.000155 let self = eskk#get_current_instance()
16 0.000722 0.000189 return call(self.get_stl, a:000, self)
FUNCTION eskk#util#has_idx()
Called 632 times
Total time: 0.005437
Self time: 0.005437
count total (s) self (s)
" Return true when negative idx.
" let idx = a:idx >= 0 ? a:idx : len(a:list) + a:idx
632 0.001533 let idx = a:idx
632 0.001900 return 0 <= idx && idx < len(a:list)
FUNCTION eskk#set_up_temp_key()
Called 7 times
Total time: 0.003283
Self time: 0.000974
count total (s) self (s)
" Assumption: a:lhs must be '<Bar>' not '|'.
" Save current a:lhs mapping.
7 0.000113 if maparg(a:lhs, 'l') != ''
" TODO Check if a:lhs is buffer local.
7 0.000203 0.000144 call eskk#util#log('Save temp key: ' . maparg(a:lhs, 'l'))
7 0.000524 0.000460 execute 'lmap' '<buffer>' s:temp_key_map(a:lhs) maparg(a:lhs, 'l')
7 0.000014 endif
7 0.000019 if a:0
execute 'lmap' '<buffer>' a:lhs a:1
else
7 0.002257 0.000071 call eskk#set_up_key(a:lhs)
7 0.000014 endif
FUNCTION eskk#get_current_instance()
Called 189 times
Total time: 0.001829
Self time: 0.001829
count total (s) self (s)
189 0.001425 return s:eskk_instances[s:instance_id]
FUNCTION eskk#util#has_key_f()
Called 5 times
Total time: 0.000936
Self time: 0.000083
count total (s) self (s)
5 0.000929 0.000076 return call('s:follow', [1] + a:000)
FUNCTION eskk#dictionary#new()
Called 1 time
Total time: 0.000108
Self time: 0.000073
count total (s) self (s)
1 0.000004 if type(a:dict_info) == type([])
1 0.000060 0.000025 let dicts = map(copy(a:dict_info), 's:physical_dict_new(v:val.path, v:val.sorted, v:val.encoding, get(v:val, "is_user_dict", 0))')
1 0.000003 elseif type(a:dict_info) == type({})
return eskk#dictionary#new([a:dict_info])
else
throw eskk#internal_error(['eskk', 'dictionary'], "eskk#dictionary#new(): invalid argument")
endif
" Check if any dictionary has "is_user_dict" key.
1 0.000002 let user_dict = {}
1 0.000001 let found = 0
1 0.000002 for d in dicts
1 0.000002 if d.is_user_dict
1 0.000002 let user_dict = d
1 0.000001 let found = 1
1 0.000002 break
endif
endfor
1 0.000001 if !found
throw eskk#internal_error(['eskk', 'dictionary'], "No 'is_user_dict' key in dictionaries.")
endif
1 0.000007 return extend( deepcopy(s:dict), {'_physical_dicts': dicts, '_user_dict': user_dict}, 'force')
FUNCTION eskk#util#eval_key()
Called 615 times
Total time: 0.022315
Self time: 0.015613
count total (s) self (s)
" From arpeggio.vim
615 0.010426 0.003724 let keys = s:split_to_keys(a:key)
615 0.007920 call map(keys, 'v:val =~ "^<.*>$" ? eval(''"\'' . v:val . ''"'') : v:val')
615 0.001912 return join(keys, '')
FUNCTION eskk#is_enabled()
Called 31 times
Total time: 0.001242
Self time: 0.000818
count total (s) self (s)
31 0.000659 0.000373 let self = eskk#get_current_instance()
31 0.000487 0.000349 return call(self.is_enabled, [], self)
FUNCTION eskk#disable()
Called 1 time
Total time: 0.001234
Self time: 0.000041
count total (s) self (s)
1 0.000036 0.000020 let self = eskk#get_current_instance()
1 0.001194 0.000017 return call(self.disable, [], self)
FUNCTION eskk#get_mode()
Called 1 time
Total time: 0.000047
Self time: 0.000030
count total (s) self (s)
1 0.000024 0.000012 let self = eskk#get_current_instance()
1 0.000019 0.000014 return call(self.get_mode, a:000, self)
FUNCTION eskk#table#get_map_to()
Called 5 times
Total time: 0.001044
Self time: 0.000322
count total (s) self (s)
5 0.000408 0.000091 let def = s:get_table(a:table_name)
5 0.000488 0.000083 if empty(def) || !eskk#table#has_map(a:table_name, a:lhs)
if a:0 == 0
throw eskk#internal_error(['eskk', 'table'])
else
return a:1
endif
endif
5 0.000029 return def[a:lhs].map_to
FUNCTION eskk#table#rom_to_kata#load()
Called 1 time
Total time: 0.000002
Self time: 0.000002
count total (s) self (s)
" dummy
FUNCTION eskk#table#table_begin()
Called 3 times
Total time: 0.000047
Self time: 0.000047
count total (s) self (s)
3 0.000012 let s:current_table_name = a:name
3 0.000012 if !has_key(s:table_defs, s:current_table_name)
3 0.000012 let s:table_defs[s:current_table_name] = {}
3 0.000003 endif
FUNCTION eskk#table#map()
Called 575 times
Total time: 0.103212
Self time: 0.020512
count total (s) self (s)
575 0.026330 0.003267 let [rest] = eskk#util#get_args(a:000, '')
575 0.005314 0.003645 if !s:is_mapping_table() | return | endif
" a:lhs is already defined and not banged.
575 0.022575 0.003137 let evaled_lhs = eskk#util#eval_key(a:lhs)
575 0.021391 0.003529 if !eskk#table#has_map(a:table_name, evaled_lhs) || a:force
575 0.024699 0.004031 call s:create_map(a:table_name, evaled_lhs, a:rhs, rest)
575 0.000459 endif
FUNCTION eskk#unlock_old_str()
Called 10 times
Total time: 0.000439
Self time: 0.000276
count total (s) self (s)
10 0.000214 0.000117 let self = eskk#get_current_instance()
10 0.000193 0.000127 return call(self.unlock_old_str, a:000, self)
FUNCTION eskk#table#get_rest()
Called 5 times
Total time: 0.001829
Self time: 0.000230
count total (s) self (s)
5 0.000338 0.000065 let def = s:get_table(a:table_name)
5 0.001400 0.000074 if empty(def) || !eskk#table#has_rest(a:table_name, a:lhs)
5 0.000016 if a:0 == 0
throw eskk#internal_error(['eskk', 'table'])
else
5 0.000015 return a:1
endif
endif
return def[a:lhs].rest
FUNCTION eskk#get_mutable_stash()
Called 1 time
Total time: 0.000013
Self time: 0.000013
count total (s) self (s)
1 0.000005 let obj = deepcopy(s:mutable_stash, 1)
1 0.000004 let obj.namespace = join(a:namespace, '-')
1 0.000001 return obj
FUNCTION eskk#util#logf()
Called 100 times
Total time: 0.003106
Self time: 0.002165
count total (s) self (s)
100 0.002891 0.001950 call eskk#util#log(call('printf', [a:fmt] + a:000))
FUNCTION eskk#get_buftable()
Called 5 times
Total time: 0.000198
Self time: 0.000129
count total (s) self (s)
5 0.000098 0.000051 let self = eskk#get_current_instance()
5 0.000083 0.000061 return call(self.get_buftable, a:000, self)
FUNCTION eskk#lock_old_str()
Called 10 times
Total time: 0.000471
Self time: 0.000304
count total (s) self (s)
10 0.000225 0.000126 let self = eskk#get_current_instance()
10 0.000213 0.000145 return call(self.lock_old_str, a:000, self)
FUNCTION eskk#get_special_key()
Called 7 times
Total time: 0.000316
Self time: 0.000173
count total (s) self (s)
7 0.000128 0.000069 let self = eskk#get_current_instance()
7 0.000168 0.000084 return call(self.get_special_key, a:000, self)
FUNCTION eskk#mode#builtin#set_table()
Called 1 time
Total time: 0.000076
Self time: 0.000015
count total (s) self (s)
1 0.000021 0.000007 call eskk#util#logf("Set '%s' table to s:current_table.", a:table_name)
1 0.000054 0.000007 call s:stash.set('current_table', s:[a:table_name])
FUNCTION eskk#map_mode_local_keys()
Called 1 time
Total time: 0.004720
Self time: 0.000429
count total (s) self (s)
1 0.000062 0.000015 let mode = eskk#get_mode()
1 0.000035 let keys = { 'hira': [ 'henkan-select:choose-next', 'henkan-select:choose-prev', 'henkan-select:next-page', 'henkan-select:prev-page', 'mode:hira:q-key', 'mode:hira:to-ascii', 'mode:hira:to-zenei', ], 'kata': [ 'henkan-select:choose-next', 'henkan-select:choose-prev', 'henkan-select:next-page', 'henkan-select:prev-page', 'mode:kata:q-key', 'mode:kata:to-ascii', 'mode:kata:to-zenei', ], 'ascii': [ 'mode:ascii:to-hira', ], 'zenei': [ 'mode:zenei:to-hira', ],}
1 0.000007 if has_key(keys, mode)
8 0.000027 for key in keys[mode]
7 0.000408 0.000092 let real_key = eskk#get_special_key(key)
7 0.003355 0.000072 call eskk#set_up_temp_key(real_key)
7 0.000776 0.000131 call eskk#register_temp_event('leave-mode-' . mode, 'eskk#set_up_temp_key_restore', [real_key])
7 0.000012 endfor
1 0.000001 endif
FUNCTION eskk#util#skip_spaces()
Called 1761 times
Total time: 0.011082
Self time: 0.011082
count total (s) self (s)
1761 0.009344 return substitute(a:str, '^\s*', '', '')
FUNCTION eskk#filter()
Called 10 times
Total time: 0.048988
Self time: 0.000403
count total (s) self (s)
10 0.000323 0.000186 let self = eskk#get_current_instance()
10 0.048619 0.000171 return call(self.filter, a:000, self)
FUNCTION eskk#table#undefine_macro()
Called 3 times
Total time: 0.000018
Self time: 0.000018
count total (s) self (s)
3 0.000004 delcommand TableBegin
3 0.000001 delcommand TableEnd
3 0.000001 delcommand Map
3 0.000002 delcommand Unmap
FUNCTION eskk#util#unget_arg()
Called 575 times
Total time: 0.001922
Self time: 0.001922
count total (s) self (s)
575 0.001343 return a:str . a:arg
FUNCTION eskk#set_up_key()
Called 106 times
Total time: 0.026229
Self time: 0.002927
count total (s) self (s)
106 0.000273 if a:0
return s:map_key(a:key, s:mapopt_chars2dict(a:1))
else
106 0.024866 0.001564 return s:map_key(a:key, s:create_default_mapopt())
endif
FUNCTION eskk#util#get_local_func()
Called 5 times
Total time: 0.000078
Self time: 0.000078
count total (s) self (s)
" :help <SID>
5 0.000058 return printf('<SNR>%d_%s', a:sid, a:funcname)
FUNCTION eskk#table#has_rest()
Called 5 times
Total time: 0.001326
Self time: 0.000120
count total (s) self (s)
5 0.001315 0.000109 return eskk#util#has_key_f(s:get_table(a:table_name), [a:lhs, 'rest'])
FUNCTION eskk#register_temp_event()
Called 12 times
Total time: 0.001193
Self time: 0.000317
count total (s) self (s)
12 0.000224 0.000125 let self = eskk#get_current_instance()
12 0.000937 0.000160 return call(self.register_temp_event, a:000, self)
FUNCTION eskk#is_sticky_key()
Called 10 times
Total time: 0.001320
Self time: 0.000284
count total (s) self (s)
10 0.000215 0.000119 let self = eskk#get_current_instance()
10 0.001075 0.000135 return call(self.is_sticky_key, a:000, self)
FUNCTION eskk#util#get_args()
Called 575 times
Total time: 0.023063
Self time: 0.018754
count total (s) self (s)
575 0.001278 let ret_args = []
575 0.000863 let i = 0
1150 0.002934 while i < len(a:000)
575 0.009136 0.004827 call add( ret_args, eskk#util#has_idx(a:args, i) ? a:args[i] : a:000[i])
575 0.001095 let i += 1
575 0.000654 endwhile
575 0.000778 return ret_args
FUNCTION eskk#util#mb_strlen()
Called 11 times
Total time: 0.000205
Self time: 0.000205
count total (s) self (s)
11 0.000177 return strlen(substitute(copy(a:str), '.', 'x', 'g'))
FUNCTION eskk#is_big_letter()
Called 10 times
Total time: 0.000499
Self time: 0.000289
count total (s) self (s)
10 0.000213 0.000116 let self = eskk#get_current_instance()
10 0.000251 0.000138 return call(self.is_big_letter, a:000, self)
FUNCTION eskk#table#table_end()
Called 3 times
Total time: 0.000010
Self time: 0.000010
count total (s) self (s)
3 0.000009 let s:current_table_name = ''
FUNCTION eskk#table#rom_to_hira#load()
Called 1 time
Total time: 0.000002
Self time: 0.000002
count total (s) self (s)
" dummy
FUNCTION eskk#util#get_arg()
Called 1761 times
Total time: 0.019182
Self time: 0.019182
count total (s) self (s)
1761 0.009171 let matched = matchstr(a:arg, '^\S\+')
1761 0.007475 return [matched, strpart(a:arg, strlen(matched))]
FUNCTION eskk#mode#builtin#update_dictionary()
Called 1 time
Total time: 0.000107
Self time: 0.000022
count total (s) self (s)
1 0.000103 0.000018 call s:stash.get('skk_dict').update_dictionary()
FUNCTION eskk#table#rom_to_zenei#load()
Called 1 time
Total time: 0.000001
Self time: 0.000001
count total (s) self (s)
" dummy
FUNCTION eskk#util#log()
Called 131 times
Total time: 0.001234
Self time: 0.001234
count total (s) self (s)
131 0.000526 if !g:eskk_debug
131 0.000273 return
endif
redraw
if exists('g:eskk_debug_file')
let file = expand(g:eskk_debug_file)
if filereadable(file)
call writefile(readfile(file) + [a:msg], file)
else
call writefile([a:msg], file)
endif
else
call eskk#util#warn(a:msg)
endif
if g:eskk_debug_wait_ms !=# 0
execute printf('sleep %dm', g:eskk_debug_wait_ms)
endif
FUNCTION eskk#kakutei_str()
Called 1 time
Total time: 0.000428
Self time: 0.000030
count total (s) self (s)
1 0.000023 0.000012 let self = eskk#get_current_instance()
1 0.000401 0.000014 return call(self.kakutei_str, a:000, self)
FUNCTION eskk#is_special_lhs()
Called 30 times
Total time: 0.003865
Self time: 0.000868
count total (s) self (s)
30 0.000637 0.000350 let self = eskk#get_current_instance()
30 0.003130 0.000420 return call(self.is_special_lhs, a:000, self)
FUNCTION eskk#table#get_candidates()
Called 10 times
Total time: 0.013145
Self time: 0.012455
count total (s) self (s)
" TODO
" Current implementation is smart but heavy.
" Make table like this?
" 's': {
" 'a': {'map_to': 'さ'},
"
" .
" .
" .
"
" 'y': {'a': {'map_to': 'しゃ'}}
" }
" But this uses a lot of memory.
"
10 0.000239 0.000127 if !s:load_table(a:table_name)
let msg = printf("can't load table '%s'.", a:table_name)
throw eskk#internal_error(['eskk', 'table'], msg)
endif
10 0.000051 if empty(a:str_buf)
throw eskk#internal_error(['eskk', 'table'], "a:str_buf is empty.")
endif
10 0.000051 let no_table = {}
10 0.000739 0.000161 let def = s:get_table(a:table_name, no_table)
10 0.000045 if def is no_table
return no_table
else
10 0.011456 return filter( keys(def), 'stridx(v:val, a:str_buf) == 0')
endif
FUNCTION eskk#util#assert()
Called 1195 times
Total time: 0.007589
Self time: 0.007589
count total (s) self (s)
1195 0.001852 if !a:cond
throw call('eskk#assertion_failure_error', [['eskk', 'util']] + a:000)
endif
FUNCTION eskk#table#new()
Called 3 times
Total time: 0.214936
Self time: 0.000057
count total (s) self (s)
3 0.214896 0.000017 call s:load_table(a:table_name)
3 0.000016 let obj = deepcopy(s:table_obj)
3 0.000009 let obj.table_name = a:table_name
3 0.000003 return obj
FUNCTION eskk#toggle()
Called 1 time
Total time: 0.252823
Self time: 0.000036
count total (s) self (s)
1 0.000033 0.000018 let self = eskk#get_current_instance()
1 0.252786 0.000014 return call(self.toggle, [], self)
FUNCTION eskk#table#define_macro()
Called 3 times
Total time: 0.000066
Self time: 0.000066
count total (s) self (s)
3 0.000015 command! -buffer -nargs=1 TableBegin call s:cmd_table_begin(<f-args>)
3 0.000010 command! -buffer TableEnd call s:cmd_table_end()
3 0.000018 command! -buffer -nargs=+ -bang Map call s:cmd_map(<q-args>, "<bang>")
3 0.000018 command! -buffer -nargs=+ -bang Unmap call s:cmd_unmap(<q-args>, "<bang>")
FUNCTION eskk#mode#builtin#asym_filter()
Called 10 times
Total time: 0.037127
Self time: 0.003047
count total (s) self (s)
10 0.000067 let char = a:stash.char
10 0.000180 0.000129 let henkan_phase = a:stash.buftable.get_henkan_phase()
" In order not to change current buftable old string.
10 0.000567 0.000096 call eskk#lock_old_str()
10 0.000027 try
" Handle special char.
" These characters are handled regardless of current phase.
10 0.000085 if char ==# "\<BS>" || char ==# "\<C-h>"
call s:do_backspace(a:stash)
return
elseif char ==# "\<CR>"
call s:do_enter(a:stash)
return
elseif eskk#is_sticky_key(char)
call eskk#sticky_key(a:stash)
return
elseif eskk#is_big_letter(char)
call eskk#sticky_key(a:stash)
call eskk#filter(tolower(char))
return
else
" Fall through.
10 0.000020 endif
10 0.000025 finally
10 0.000537 0.000098 call eskk#unlock_old_str()
10 0.000029 endtry
10 0.001123 0.000138 if s:stash.get('current_table') is s:rom_to_hira " hira
10 0.001446 0.000137 if eskk#is_special_lhs(char, 'mode:hira:q-key')
call eskk#mode#builtin#do_q_key(a:stash)
return
elseif eskk#is_special_lhs(char, 'mode:hira:to-ascii')
call eskk#set_mode('ascii')
return
elseif eskk#is_special_lhs(char, 'mode:hira:to-zenei')
call eskk#set_mode('zenei')
return
else
" Fall through.
10 0.000021 endif
10 0.000022 else " kata
if eskk#is_special_lhs(char, 'mode:kata:q-key')
call eskk#mode#builtin#do_q_key(a:stash)
return
elseif eskk#is_special_lhs(char, 'mode:kata:to-ascii')
call eskk#set_mode('ascii')
return
elseif eskk#is_special_lhs(char, 'mode:kata:to-zenei')
call eskk#set_mode('zenei')
return
else
" Fall through.
endif
endif
10 0.000066 if henkan_phase ==# g:eskk#buftable#HENKAN_PHASE_NORMAL
10 0.026607 0.000157 return s:filter_rom_to_hira(a:stash)
elseif henkan_phase ==# g:eskk#buftable#HENKAN_PHASE_HENKAN
if eskk#is_henkan_key(char)
return s:henkan_key(a:stash)
call eskk#util#assert(a:stash.buftable.get_henkan_phase() == g:eskk#buftable#HENKAN_PHASE_HENKAN_SELECT)
else
return s:filter_rom_to_hira(a:stash)
endif
elseif henkan_phase ==# g:eskk#buftable#HENKAN_PHASE_OKURI
return s:filter_rom_to_hira(a:stash)
elseif henkan_phase ==# g:eskk#buftable#HENKAN_PHASE_HENKAN_SELECT
if eskk#is_special_lhs(char, 'henkan-select:choose-next')
return s:get_next_candidate(a:stash, 1)
elseif eskk#is_special_lhs(char, 'henkan-select:choose-prev')
return s:get_next_candidate(a:stash, 0)
else
call a:stash.buftable.set_henkan_phase(g:eskk#buftable#HENKAN_PHASE_NORMAL)
" Move henkan select buffer string to normal.
call a:stash.buftable.move_buf_str(g:eskk#buftable#HENKAN_PHASE_HENKAN_SELECT, g:eskk#buftable#HENKAN_PHASE_NORMAL)
return s:filter_rom_to_hira(a:stash)
endif
else
let msg = printf("eskk#mode#builtin#asym_filter() does not support phase %d.", phase)
throw eskk#internal_error(['eskk'], msg)
endif
FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
1 0.252823 0.000036 eskk#toggle()
3 0.214936 0.000057 eskk#table#new()
575 0.103212 0.020512 eskk#table#map()
10 0.048988 0.000403 eskk#filter()
10 0.037127 0.003047 eskk#mode#builtin#asym_filter()
106 0.026229 0.002927 eskk#set_up_key()
575 0.023063 0.018754 eskk#util#get_args()
615 0.022315 0.015613 eskk#util#eval_key()
1761 0.019182 eskk#util#get_arg()
590 0.019037 0.004388 eskk#table#has_map()
10 0.013145 0.012455 eskk#table#get_candidates()
1761 0.011082 eskk#util#skip_spaces()
1195 0.007589 eskk#util#assert()
632 0.005437 eskk#util#has_idx()
1 0.004720 0.000429 eskk#map_mode_local_keys()
30 0.003865 0.000868 eskk#is_special_lhs()
7 0.003283 0.000974 eskk#set_up_temp_key()
100 0.003106 0.002165 eskk#util#logf()
575 0.001922 eskk#util#unget_arg()
189 0.001829 eskk#get_current_instance()
FUNCTIONS SORTED ON SELF TIME
count total (s) self (s) function
575 0.103212 0.020512 eskk#table#map()
1761 0.019182 eskk#util#get_arg()
575 0.023063 0.018754 eskk#util#get_args()
615 0.022315 0.015613 eskk#util#eval_key()
10 0.013145 0.012455 eskk#table#get_candidates()
1761 0.011082 eskk#util#skip_spaces()
1195 0.007589 eskk#util#assert()
632 0.005437 eskk#util#has_idx()
590 0.019037 0.004388 eskk#table#has_map()
10 0.037127 0.003047 eskk#mode#builtin#asym_filter()
106 0.026229 0.002927 eskk#set_up_key()
100 0.003106 0.002165 eskk#util#logf()
575 0.001922 eskk#util#unget_arg()
189 0.001829 eskk#get_current_instance()
131 0.001234 eskk#util#log()
7 0.003283 0.000974 eskk#set_up_temp_key()
30 0.003865 0.000868 eskk#is_special_lhs()
31 0.001242 0.000818 eskk#is_enabled()
1 0.004720 0.000429 eskk#map_mode_local_keys()
10 0.048988 0.000403 eskk#filter()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment