supercrabtree / k

k is the new l, yo
1.78k stars 124 forks source link

It is too slow. #79

Closed kuoe0 closed 6 years ago

kuoe0 commented 7 years ago

I use k to list the files in some directory. It takes 25 sec to finish. I think maybe it is related to the size of git repo. Is it possible to be acceratted?

The repo I used is https://github.com/mozilla/gecko-dev.

GSI commented 6 years ago

The --no-vcs option speeds up things significantly. IMO the following should actually be done by k by default (PR, anyone?), but for now I just made a wrapper function:

how_k_should_do_this_by_default () {                                                                                                                                                                     
        git rev-parse --is-inside-work-tree &> /dev/null && k $@ || k --no-vcs $@
}
alias l='how_k_should_do_this_by_default'

This uses --no-vcs whenever we are not in a Git directory. (Run from within Git directories it will still use the slow but more detailled variant.)

GSI commented 6 years ago

Just realized that the above function would need to be adapted as to have the git command work on the directories we're actually inspecting. Currently it only looks at $PWD while $@ might be some faraway dir(s).

supercrabtree commented 6 years ago

Hello, I don't see the point in having the --no-vcs flag on by default. That is basically k's killer feature. Outside of a git repo it looks inside each directory listed and if it's a repo decorates the status of that repo to the output of ls. k is slow because git is slow, if you don't need the git stuff just use ls -la