netrw slow hiding with large number of ignored files

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

netrw slow hiding with large number of ignored files

Matthew Hughes
Hi all,

I'm encountering very slow (several seconds to respond) behaviour from
netrw when hiding with netrw_gitignore#Hide() and a large number of
gitignore files. I first noticed it when I pulled the 'git' source,
compiled it, and called '$ vim .' in the root directory. For context
here's a basic .vimrc to demonstrate the behaviour:

    set nocp
    filetype plugin on
    let g:netrw_hide = 1
    let g:netrw_list_hide = netrw_gitignore#Hide()

With (using runtime/autoload/netrw_gitignore.vim):

    function! netrw_gitignore#Hide(...)
      return substitute(substitute(system('git ls-files --other --ignored --exclude-standard --directory'), '\n', ',', 'g'), ',$', '', '')
    endfunction

I believe the slowdown is due to the number of ignored files, after
compiling git:

    /path/to/src/git$ git ls-files --other --ignored --exclude-standard --directory  | wc -l
    684

The slowdown is more obvious in a repo with more ignored files, e.g.:

    $ git init
    $ echo '/foo.*' > .gitignore
    $ for i in {1..2000}; do touch "foo.$i"; done
    $ vim .

Would there happen to be another way to handle ignoring a list of files
with netrw? netrw_list_hide seems geared towards hiding against a list
of match patterns, rather than explicit filenames

Thanks,
Matt

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20210305122841.upnuuele2uyltlri%40debianXPS.lan.