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

towards 2.0 #85

Merged
merged 10 commits into from
Oct 21, 2017
Merged

towards 2.0 #85

merged 10 commits into from
Oct 21, 2017

Conversation

BurntSushi
Copy link
Owner

This PR contains a smattering of commits that should bring walkdir up to 2.0. Most commits are just polishing, but also:

  1. The DirEntryExt trait wasn't actually exported. That's done now.
  2. I optimized the symbolic link checking loop in an attempt to fix this ripgrep bug. It's not related to 2.0, but I was in the code and it was an easy enough change.
  3. Upgrade to use same-file 1.0, which was just released.

Broadly speaking, this commit is an attempt to fix this issue:
BurntSushi/ripgrep#633

It was reported that symlink checking was taking a long amount of time,
and that one possible way to fix this was to reduce number of times a
file descriptor is opened. In this commit, we amortize opening file
descriptors by keeping a file handle open for each ancestor in the
directory tree. We also open a handle for the candidate file path at
most once, instead of once every iteration.

Note that we only perform this optimization on Windows, where opening a
file handle seems inordinately expensive. In particular, this now causes
us to potentially open more file descriptors than the limit set by the
user, which only happens when following symbolic links. We document this
behavior.
@BurntSushi BurntSushi merged commit 99fe056 into master Oct 21, 2017
@BurntSushi BurntSushi deleted the ag/towards-2.0 branch October 21, 2017 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant