Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up .gitignores #8

Closed
martinvonz opened this issue Apr 7, 2021 · 0 comments
Closed

Speed up .gitignores #8

martinvonz opened this issue Apr 7, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@martinvonz
Copy link
Member

The current support for .gitignore files is a hack that relies on git2::Repository::status_should_ignore(). It's unnecessarily slow to call that for every file in target/ when the .gitignore file contains /target/ -- we should be able to look at the directory and skip all of it.

We may want to fix this by parsing .gitignore files ourselves.

@martinvonz martinvonz added the enhancement New feature or request label Apr 7, 2021
martinvonz added a commit that referenced this issue May 14, 2021
This is to address issue #8. I haven't added the optimization to avoid
walking all the files in `target/` yet. Even so, this patch still
speeds up `jj st` in this repo, with ~13k files in `target/`, from
~320 ms to ~100 ms (-5.1dB). The time actually checking if paths match
gitignores seems to go down from 116 ms to 6 ms. I think that's mostly
because libgit2 has to look for `.gitignore` files in every parent
directory every time we ask it about a file, while the rewritten code
looks for a `.gitignore` file only when visiting a new directory.
martinvonz added a commit that referenced this issue May 14, 2021
This makes the workging copy walk skip an entire ignored directory if
there are no negative patterns later in the ignore file. That speeds
up `jj st` in this repo with ~13k files in `target/` from ~100 ms to
~25 ms (6.0dB). This closes issue #8.
xxxserxxx pushed a commit to xxxserxxx/jj that referenced this issue Mar 14, 2023
Use mod for ease of build; adjust import to fix build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant