username4gh/dotfiles

performance issue on function completion_generate

Closed this issue · 3 comments

$ time completion_generate

real 0m5.164s
user 0m2.400s
sys 0m2.014s

It's really slow for a few lines of code.

$ time find "$MY_SH_MODULE" -type f -iname "*.bash" | s 'src'

real 0m0.033s
user 0m0.020s
sys 0m0.016s

so it's not the file-finding that takes too much time.

after i commented out the '_completion_register_generate' part of code in the completion_generate function, i time completion_generate again, the result is below:

$ time completion_generate

real 0m1.746s
user 0m0.961s
sys 0m0.643s

for the current code base, _completion_register_generate only 'annotate' in two place:

sh/module/git/src/gitignore.bash
35:_completion_register_generate my_git_ignore_init $MY_REPO/gitignore gitignore

sh/module/info/src/infos.bash
7:_completion_register_generate my_info $MY_SH_MODULE/info/infos info

no use any more