Skip to content

feat: dont do needless search when we reach max depth - #2566

Closed
sigmaSd wants to merge 6 commits into
BurntSushi:masterfrom
sigmaSd:leaf
Closed

feat: dont do needless search when we reach max depth#2566
sigmaSd wants to merge 6 commits into
BurntSushi:masterfrom
sigmaSd:leaf

Conversation

@sigmaSd

@sigmaSd sigmaSd commented Jul 23, 2023

Copy link
Copy Markdown

fix #2565

I can improve the code, if in general it seems reasonable,
seems to work in my testing

@sigmaSd

sigmaSd commented Jul 23, 2023

Copy link
Copy Markdown
Author

Btw this gets it down to 3 syscalls per entry when max depth is reached

openat(AT_FDCWD, "/home/mrcool/dev/rust/nanoserde", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
newfstatat(4, "", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_EMPTY_PATH) = 0
close(4)                                = 0
openat(AT_FDCWD, "/home/mrcool/dev/rust/message-io", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
newfstatat(4, "", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_EMPTY_PATH) = 0
close(4)                                = 0
openat(AT_FDCWD, "/home/mrcool/dev/rust/mun_example", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
newfstatat(4, "", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_EMPTY_PATH) = 0
close(4)                                = 0
openat(AT_FDCWD, "/home/mrcool/dev/rust/progress", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
newfstatat(4, "", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_EMPTY_PATH) = 0

But I imagine even those are not needed, but I guess its probably negligible

@BurntSushi

Copy link
Copy Markdown
Owner

Thank you, but I'm going to pass on this for now. I hope to do an overhaul of the ignore crate soon, and I'll see if it makes sense to take max depth into account at a more fundamental level. I'm not quite comfortable with this change as-is because I think it's a little too hacky. (Which isn't your fault. The crate's internals are an awful mess and I barely understand it any more.)

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.

perf(ignore): don't search subdirs for git/ignore files if max depth is reached

2 participants