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

feat(git): Use fs instead of git for file listing #7277

Closed
wants to merge 6 commits into from

Conversation

zharinov
Copy link
Collaborator

No description provided.

lib/util/git/index.ts Outdated Show resolved Hide resolved
lib/util/git/index.ts Outdated Show resolved Hide resolved
return [];
}
const [submodules, files]: [string[], Dirent[]] = await Promise.all([
getSubmodules(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this in case submodules are not initialised?

lib/util/git/index.ts Outdated Show resolved Hide resolved
lib/util/git/index.ts Outdated Show resolved Hide resolved
@rarkins
Copy link
Collaborator

rarkins commented Sep 15, 2020

@zharinov can you find a large repo to test this out on? I'd like to make sure it runs as fast or faster than the existing git approach.

@rarkins rarkins changed the title feat(git): Use "readdir" instead of "git-ls-tree" for file listing feat(git): Use fs instead of git for file listing Sep 17, 2020
lib/util/git/index.ts Outdated Show resolved Hide resolved
lib/util/git/index.ts Outdated Show resolved Hide resolved

const files = (await fs.readdir(directory)).filter((file) =>
excludes.every(
(exclude) => file !== exclude && !file.startsWith(`${exclude}/`)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a doubt in my code now. This may not filter correctly is the submodule is nested deeper than the top level directory

@rarkins
Copy link
Collaborator

rarkins commented Sep 21, 2020

Needs Windows file path fix:

image

@zharinov
Copy link
Collaborator Author

zharinov commented Oct 4, 2020

Do we still need this, or #7349 gives us good enough performance?

@rarkins
Copy link
Collaborator

rarkins commented Oct 4, 2020

We should still do this

@zharinov
Copy link
Collaborator Author

zharinov commented Oct 6, 2020

In my machine, concurrency with queue size 2 worked faster, while increased size made no difference because of recursion.
But, ls-tree performs better for repository like this: https://github.com/zharinov/fake-repo-3 (no submodules)
fs: 80ms
concurrent fs: 40ms
ls-tree: 32ms

@rarkins
Copy link
Collaborator

rarkins commented Oct 7, 2020

I had assumed that an fs-based file listing would be more efficient than a git-based listing, but maybe that's wrong. Or maybe our fs approach is bad. @zharinov can you see if it's feasible to test with https://github.com/thecodrr/fdir instead?

@rarkins rarkins closed this Oct 19, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants