Skip to content

Add git_mempack_write_thin_pack#6875

Merged
ethomson merged 1 commit into
libgit2:mainfrom
roberth:mempack-thin-packfile
Sep 27, 2024
Merged

Add git_mempack_write_thin_pack#6875
ethomson merged 1 commit into
libgit2:mainfrom
roberth:mempack-thin-packfile

Conversation

@roberth
Copy link
Copy Markdown
Contributor

@roberth roberth commented Sep 2, 2024

Unlike existing functions, this produces a thin packfile by making use of the fact that only new objects appear in the mempack Object Database.

A thin packfile only contains certain objects, but not its whole closure of references. This makes it suitable for efficiently writing sets of new objects to a local repository, by avoiding many small I/O operations.

This relies on write_pack (e.g. git_packbuilder_write_buf) to implement the "recency order" optimization step.

Basic measurements comparing against the writing of individual objects show a speedup during when writing large amounts of content on machines with comparatively slow I/O operations, and little to no change on machines with fast I/O operations.

I have used this in NixOS/nix#11330, in conjunction with #6874

@ethomson
Copy link
Copy Markdown
Member

ethomson commented Sep 2, 2024

Thanks! Really useful addition; I'll review this shortly. 🙏

@Mic92
Copy link
Copy Markdown

Mic92 commented Sep 20, 2024

@ethomson friendly ping.

Copy link
Copy Markdown
Member

@ethomson ethomson left a comment

Choose a reason for hiding this comment

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

Thanks for this. I made two very trivial minor suggestions in keeping with the library's styling. Otherwise, a great addition. 🙏

Comment thread src/libgit2/odb_mempack.c Outdated
Comment thread src/libgit2/odb_mempack.c Outdated
Comment thread src/libgit2/odb_mempack.c Outdated
Unlike existing functions, this produces a _thin_ packfile by
making use of the fact that only new objects appear in the
mempack Object Database.

A thin packfile only contains certain objects, but not its whole
closure of references. This makes it suitable for efficiently
writing sets of new objects to a local repository, by avoiding
many small I/O operations.

This relies on write_pack (e.g. git_packbuilder_write_buf) to
implement the "recency order" optimization step.

Basic measurements comparing against the writing of individual
objects show a speedup during when writing large amounts of
content on machines with comparatively slow I/O operations,
and little to no change on machines with fast I/O operations.
@roberth roberth force-pushed the mempack-thin-packfile branch from 14e355d to f9c35fb Compare September 27, 2024 10:39
@Mic92
Copy link
Copy Markdown

Mic92 commented Sep 27, 2024

CI is green!

@ethomson ethomson merged commit 9ddd72f into libgit2:main Sep 27, 2024
@Mic92
Copy link
Copy Markdown

Mic92 commented Sep 28, 2024

Question, will this patch be part of the v1.8.2 or later?

@ethomson
Copy link
Copy Markdown
Member

I'm going to cut a release 🔜

@roberth
Copy link
Copy Markdown
Contributor Author

roberth commented Sep 29, 2024

Thank you @ethomson for reviewing and accepting!

@Ericson2314
Copy link
Copy Markdown

I'm going to cut a release 🔜

Any ETA on this?

@Mic92
Copy link
Copy Markdown

Mic92 commented Nov 24, 2024

1.8.4 was released a while ago but this patch is no included. Are the patch releases made of a different branch?

@Ericson2314
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants