Remove g:VimwikiLog and the timing stuff

For profiling, there is Vim's :profile command
This commit is contained in:
EinfachToll 2015-12-07 12:29:25 +01:00
parent 2a70e1517e
commit 9be96884ba
6 changed files with 1 additions and 50 deletions

View File

@ -185,7 +185,6 @@ endfunction "}}}
" vimwiki#base#subdir
"FIXME TODO slow and faulty
function! vimwiki#base#subdir(path, filename) "{{{
let g:VimwikiLog.subdir += 1 "XXX
let path = a:path
" ensure that we are not fooled by a symbolic link
"FIXME if we are not "fooled", we end up in a completely different wiki?

View File

@ -1367,9 +1367,6 @@ function! vimwiki#html#CustomWiki2HTML(path, wikifile, force) "{{{
endfunction " }}}
function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
let starttime = reltime() " start the clock
let done = 0
let wikifile = fnamemodify(a:wikifile, ":p")
@ -1496,7 +1493,7 @@ function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
call map(html_lines, 'substitute(v:val, "%encoding%", "'. enc .'", "g")')
let html_lines = s:html_insert_contents(html_lines, ldest) " %contents%
"" make html file.
call writefile(html_lines, path_html.htmlfile)
let done = 1
@ -1508,10 +1505,6 @@ function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
return
endif
" measure the elapsed time
let time1 = vimwiki#u#time(starttime) "XXX
call VimwikiLog_extend('html',[htmlfile,time1])
return path_html.htmlfile
endfunction "}}}

View File

@ -32,11 +32,6 @@ function! vimwiki#u#is_macos()
return os == 'Darwin' || os == 'Mac'
endfunction
function! vimwiki#u#time(starttime) "{{{
" measure the elapsed time and cut away miliseconds and smaller
return matchstr(reltimestr(reltime(a:starttime)),'\d\+\(\.\d\d\)\=')
endfunction "}}}
function! vimwiki#u#count_first_sym(line) "{{{
let first_sym = matchstr(a:line, '\S')
return len(matchstr(a:line, first_sym.'\+'))

View File

@ -11,18 +11,6 @@ let g:loaded_vimwiki = 1
let s:old_cpo = &cpo
set cpo&vim
" Logging and performance instrumentation "{{{
let g:VimwikiLog = {}
let g:VimwikiLog.path = 0 " # of calls to VimwikiGet with path or path_html
let g:VimwikiLog.path_html = 0 " # of calls to path_html()
let g:VimwikiLog.normalize_path = 0 " # of calls to normalize_path()
let g:VimwikiLog.subdir = 0 " # of calls to vimwiki#base#subdir()
let g:VimwikiLog.timing = [] " various timing measurements
let g:VimwikiLog.html = [] " html conversion timing
function! VimwikiLog_extend(what,...) "{{{
call extend(g:VimwikiLog[a:what],a:000)
endfunction "}}}
"}}}
" HELPER functions {{{
function! s:default(varname, value) "{{{
@ -36,14 +24,12 @@ function! s:path_html(idx) "{{{
if !empty(path_html)
return path_html
else
let g:VimwikiLog.path_html += 1 "XXX
let path = VimwikiGet('path', a:idx)
return substitute(path, '[/\\]\+$', '', '').'_html/'
endif
endfunction "}}}
function! s:normalize_path(path) "{{{
let g:VimwikiLog.normalize_path += 1 "XXX
" resolve doesn't work quite right with symlinks ended with / or \
let path = substitute(a:path, '[/\\]\+$', '', '')
if path !~# '^scp:'
@ -85,7 +71,6 @@ function! s:setup_buffer_leave() "{{{
endfunction "}}}
function! s:setup_filetype() "{{{
let time0 = reltime() " start the clock "XXX
" Find what wiki current buffer belongs to.
let path = expand('%:p:h')
let idx = vimwiki#base#find_wiki(path)
@ -115,12 +100,9 @@ function! s:setup_filetype() "{{{
unlet! b:vimwiki_fs_rescan
set filetype=vimwiki
let time1 = vimwiki#u#time(time0) "XXX
call VimwikiLog_extend('timing',['plugin:setup_filetype:time1',time1])
endfunction "}}}
function! s:setup_buffer_enter() "{{{
let time0 = reltime() " start the clock "XXX
if !vimwiki#base#recall_buffer_state()
" Find what wiki current buffer belongs to.
" If wiki does not exist in g:vimwiki_list -- add new wiki there with
@ -170,7 +152,6 @@ function! s:setup_buffer_enter() "{{{
endif
let b:vimwiki_fs_rescan = 1
endif
let time1 = vimwiki#u#time(time0) "XXX
" Settings foldmethod, foldexpr and foldtext are local to window. Thus in a
" new tab with the same buffer folding is reset to vim defaults. So we
@ -200,8 +181,6 @@ function! s:setup_buffer_enter() "{{{
if g:vimwiki_menu != ""
exe 'nmenu enable '.g:vimwiki_menu.'.Table'
endif
"let time2 = vimwiki#u#time(time0) "XXX
call VimwikiLog_extend('timing',['plugin:setup_buffer_enter:time1',time1])
endfunction "}}}
function! s:setup_buffer_reenter() "{{{

View File

@ -10,14 +10,12 @@ elseif exists("b:current_syntax")
endif
"TODO do nothing if ...? (?)
let g:starttime = reltime() " start the clock
if VimwikiGet('maxhi')
let b:existing_wikifiles =
\ vimwiki#base#get_wikilinks(g:vimwiki_current_idx, 1)
let b:existing_wikidirs =
\ vimwiki#base#get_wiki_directories(g:vimwiki_current_idx)
endif
let s:timescans = vimwiki#u#time(g:starttime) "XXX
"let b:xxx = 1
"TODO ? update wikilink syntax group here if really needed (?) for :e and such
"if VimwikiGet('maxhi')
@ -47,8 +45,6 @@ let g:vimwiki_rxWeblinkUrl = g:vimwiki_rxWebProtocols .
call vimwiki#u#reload_regexes()
let s:time0 = vimwiki#u#time(g:starttime) "XXX
" LINKS: setup of larger regexes {{{
" LINKS: setup wikilink regexps {{{
@ -246,16 +242,12 @@ if VimwikiGet('maxhi')
call s:add_target_syntax_OFF(g:vimwiki_rxWikiIncl)
" Subsequently, links verified on vimwiki's path are highlighted as existing
let s:time01 = vimwiki#u#time(g:starttime) "XXX
call s:highlight_existing_links()
let s:time02 = vimwiki#u#time(g:starttime) "XXX
else
let s:time01 = vimwiki#u#time(g:starttime) "XXX
" Wikilink
call s:add_target_syntax_ON(g:vimwiki_rxWikiLink, 'VimwikiLink')
" WikiIncl
call s:add_target_syntax_ON(g:vimwiki_rxWikiIncl, 'VimwikiLink')
let s:time02 = vimwiki#u#time(g:starttime) "XXX
endif
" Weblink
@ -613,6 +605,3 @@ call vimwiki#base#nested_syntax('tex',
syntax spell toplevel
let s:timeend = vimwiki#u#time(g:starttime) "XXX
call VimwikiLog_extend('timing',['syntax:scans',s:timescans],['syntax:regexloaded',s:time0],['syntax:beforeHLexisting',s:time01],['syntax:afterHLexisting',s:time02],['syntax:end',s:timeend])

View File

@ -285,14 +285,10 @@ if VimwikiGet('maxhi')
call s:add_target_syntax_OFF(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1')
" Subsequently, links verified on vimwiki's path are highlighted as existing
let s:time01 = vimwiki#u#time(g:starttime) "XXX
call s:highlight_existing_links()
let s:time02 = vimwiki#u#time(g:starttime) "XXX
else
let s:time01 = vimwiki#u#time(g:starttime) "XXX
" Wikilink
call s:add_target_syntax_ON(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1')
let s:time02 = vimwiki#u#time(g:starttime) "XXX
endif
" Weblink