Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

performance - ctrlp is being slow #529

Closed
korovkin opened this Issue · 2 comments

2 participants

@korovkin

i have a pretty large project with 100k files:

find . -type f | wc -l
107824

when i use ctrl+p, it take a while to list the files which is expected.
but, when it's done listing, it works well as long as i type in only 4-5 letters...

Search strings that are longer, usually stall the UI for 3-5 seconds each...
what am i missing here?

i am on a brand new macbook pro with an ssd drive - top notch hw ;)

@kien
Owner

It's just Vimscript being slow when the list is too large. You'll have to employ an external matcher with g:ctrlp_match_func, preferably written in a faster language. Nothing else really helps.

@kien kien closed this
@korovkin

thanks for the tip!

i ended up doing this:
(I am not interested in the fuzzy finger, just grepping will do)

let g:ctrlp_match_func = { 'match': 'GrepMatch' }

function! GrepMatch(items, str, limit, mmode, ispath, crfile, regex)
let query = a:str
if query == ""
let query = "."
endif

let cachefile = '.files'
if !filereadable(cachefile)
let files = split(system('find . -type f -name *.c -o -name *.m -o -name *.h -o -name *.mm -o -name *.cpp -o -name *.hh -o -name *.py -o -name *.java -o -name *.json -o -name *.plist -o -name *.rb -o -name *.pbxproj', "\n"))
call writefile(files, cachefile)
endif

let cmd = 'cat .files | grep -i '
let cmd = cmd.query." | head -n 100"
echo cmd
return split(system(cmd), "\n")
endfunction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.