Skip to content

Instantly share code, notes, and snippets.

View itchyny's full-sized avatar
🏠
Working from home

itchyny itchyny

🏠
Working from home
  • Cybozu, Inc.
  • Kyoto, Japan
View GitHub Profile
@itchyny
itchyny / strwidthpart_strwidthpart_reverse.vim
Last active August 29, 2015 13:56
Binary search in strwidthpart, strwidthpart_reverse
function! s:new_strwidthpart(str, width)
if a:width <= 0
return ''
endif
" Split into array
let strarr = split(a:str, '\zs')
let width = s:wcswidth(a:str)
" Start binary search
let index = len(strarr)
#!/bin/zsh
dotfile=mikutter.dot
outfile=mikutter.png
mikutterdir=../mikutter/core
echo "digraph mikutter {" > "$dotfile"
for file in $mikutterdir/*.rb; do
name=$(basename "$file" | sed 's/\.rb//')
for dependon in $(grep "^miquire :core" "$file" | sed 's/miquire.*:[a-z]*, //' | tr ',' '\n' | tr -d " '\""); do
FUNCTION vimshell#terminal#get_col()
Called 1253 times
Total time: 40.185621
Self time: 24.927843
count total (s) self (s)
" is_virtual -> a:col : real col.
" not -> a:col : virtual col.
1253 0.006099 let col = 1
1253 0.005154 let real_col = 0
FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
2000 34.890824 0.153159 neocomplete#handler#_on_insert_char_pre()
1001 34.474891 0.101379 <SNR>98_make_cache_current_line()
1001 33.387978 0.052042 neocomplete#sources#buffer#make_cache_current_line()
1002 33.356230 32.772526 <SNR>80_make_cache_current_buffer()
2016 0.965097 0.178434 neocomplete#helper#is_enabled_source()
1016 0.749196 0.056853 neocomplete#helper#ftdictionary2list()
1020 0.694174 0.020297 neocomplete#get_source_filetypes()
This is a test from gist.vim.
@itchyny
itchyny / test.vim
Last active August 29, 2015 14:13
profile start profile.log
profile func *strwidth*
set rtp+=/path/to/vital.vim/
let s:V = vital#of('vital')
let s:P = s:V.import('Prelude')
function! Error_strwidthpart()
endfunction
FUNCTION <SNR>4_new_strwidthpart_reverse()
Called 3843 times
Total time: 10.562034
Self time: 9.863578
count total (s) self (s)
3843 0.028234 if a:width <= 0
63 0.001507 return ''
endif
" Split into array
This file has been truncated, but you can view the full file.
[
{'a:keyword_pattern': ' \%(adverb\|conjunction\|dyad\|monad\|noun\|verb\) ', 'a:prefix': ''},
{'a:prefix': '', 'end': 48, 'i': 1, 'original_pattern': ' \%(adverb\|conjunction\|dyad\|monad\|noun\|verb\) ', 'pattern': ' '},
{'a:keyword_pattern': 'adverb\|conjunction\|dyad\|monad\|noun\|verb', 'a:prefix': ' '},
{'a:keyword_pattern': ' \%(Note\|\%(assert\|break\|do\)\.\@!\) ', 'a:prefix': ''},
{'a:prefix': '', 'end': 37, 'i': 1, 'original_pattern': ' \%(Note\|\%(assert\|break\|do\)\.\@!\) ', 'pattern': ' '},
{'a:keyword_pattern': 'Note\|\%(assert\|break\|do\)\.\@!', 'a:prefix': ' '},
{'a:prefix': ' ', 'end': 20, 'i': 0, 'original_pattern': '\%(assert\|break\|do\)\.\@!', 'pattern': ''},
{'a:keyword_pattern': 'assert\|break\|do', 'a:prefix': ''},
{'a:keyword_pattern': '"\|`:\| \|&\.:\| \%( \.\| :\)', 'a:prefix': ''},
FUNCTION neocomplete#variables#get_source()
Called 1 time
Total time: 0.000028
Self time: 0.000028
count total (s) self (s)
1 0.000010 if !exists('s:sources')
let s:sources = {}
endif
1 0.000010 return get(s:sources, a:name, {})
FUNCTION neocomplete#custom#get()
Called 8 times
Total time: 0.000206
Self time: 0.000206
count total (s) self (s)
8 0.000060 if !exists('s:custom')
let s:custom = {}
let s:custom.sources = {}
let s:custom.sources._ = {}