Skip to content

checkout: Create directories similar to and consider using a cache #343

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

Merged
merged 19 commits into from
Mar 4, 2022

Conversation

Byron
Copy link
Member

@Byron Byron commented Mar 2, 2022

A custom crate_dir_all() with a cache similar to how git does it.

Tasks

  • progress support for files per second and bytes written
  • a sub-command to checkout an index with dummy files (skip symlinks though)
    • support providing an ODB as well
  • a cache for creating directories fast
  • do not allow symlinks in the path unless it's the checkout root

@Byron Byron changed the title Create directories similar to and consider using a cache (but don't end up with . Create directories similar to and consider using a cache Mar 2, 2022
@Byron Byron changed the title Create directories similar to and consider using a cache checkout: Create directories similar to and consider using a cache Mar 2, 2022
Byron added 19 commits March 4, 2022 14:26
The windows file check needs to handle relative links properly when checking for file type.
For now just with empty files, but that shows that with a single thread
it's faster than git at 27k files per second created compared to 14.5k
of a single thread of git.

We do the least amount of work necessary even without an lstat cache,
but that probably changes once we have to access the ODB to obtain
actual data.

Note that git might also do an additional exists check per file
to see if it changed, something we don't do as we may assume
exclusive access to the directory and just go with that for now.

Long story short: it looks like there is a lot of potential for
performance improvements and I think there is a lot of room for
being faster especially in multi-threaded mode.
This should tell us how much time it really takes to do the ODB part,
and see how much we could save by optimizing disk access, for instance
by using an lstat cache.
Git is able to use relative paths by changing the working directory.

See https://github.com/git/git/blob/main/builtin.h#L82:L82

We probably shouldn't do that as a library, but will compose the path
instead like we do now, but should consider using the cache for file
and directory handling to avoid allocations.
This comes at a cost, but hopefully this is justified performance
wise but most importantly, makes the upcoming implementation of the
lstat cache possible or easier.
We now definitely do extra work in some cases, but save a lot in others
thanks to the sorted input.
@Byron Byron merged commit 0e2a243 into main Mar 4, 2022
@Byron Byron deleted the create-dir branch March 4, 2022 06:36
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