Created
September 13, 2012 21:45
-
-
Save chikatoike/3717916 to your computer and use it in GitHub Desktop.
neocomplcache caching performance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " test for https://github.com/chikatoike/neocomplcache/tree/cache-experimental | |
| let s:sfile = globpath(&runtimepath, 'autoload/neocomplcache/async_cache.vim') | |
| function! s:async_load_from_file(call_system, cache_dir, filename, pattern, mark)"{{{ | |
| let pattern_file_name = | |
| \ neocomplcache#cache#encode_name('keyword_patterns', a:filename) | |
| let cache_name = | |
| \ neocomplcache#cache#encode_name(a:cache_dir, a:filename) | |
| " Create pattern file. | |
| call neocomplcache#cache#writefile( | |
| \ 'keyword_patterns', a:filename, [a:pattern]) | |
| " args: funcname, outputname, filename pattern mark | |
| " minlen maxlen encoding | |
| let fileencoding = | |
| \ &fileencoding == '' ? &encoding : &fileencoding | |
| let argv = [ | |
| \ 'load_from_file', cache_name, a:filename, pattern_file_name, a:mark, | |
| \ g:neocomplcache_min_keyword_length, | |
| \ g:neocomplcache_max_menu_width, fileencoding | |
| \ ] | |
| return s:async_load(a:call_system, argv, a:cache_dir, a:filename) | |
| endfunction"}}} | |
| function! s:async_load(call_system, argv, cache_dir, filename)"{{{ | |
| let t = reltime() | |
| if a:call_system | |
| let vim_path = 'vim' | |
| let args = [vim_path, '-u', 'NONE', '-i', 'NONE', '-n', | |
| \ '-N', '-S', s:sfile] | |
| \ + a:argv | |
| call vimproc#system(args) | |
| " call system(join(args)) | |
| else | |
| call neocomplcache#async_cache#main(a:argv) | |
| endif | |
| echo 'elapsed:' reltimestr(reltime(t)) | |
| return neocomplcache#cache#encode_name(a:cache_dir, a:filename) | |
| endfunction"}}} | |
| let path = expand('$VIMHOME/.vimrc') | |
| let keyword_pattern = neocomplcache#get_keyword_pattern('vim') | |
| " call s:async_load_from_file(0, 'buffer_cache', path, keyword_pattern, 'X') | |
| call s:async_load_from_file(1, 'buffer_cache', path, keyword_pattern, 'X') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Result: 8.685060sec -> 3.118601