git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Should I store large text files on Git LFS?

From
Andrew Ardill <andrew.ardill@gmail.com>
Date
Jul 25, 2017, 08:06 UTC
Message-ID
<CAH5451nbY+Xo0Fpe2OdsxwJeRV1ddZmYX7v-bPYgRsbS2kNJSg@mail.gmail.com>
In-Reply-To
<20170724181118.ntqjqfihhblbvwmi@sigill.intra.peff.net>
On 25 July 2017 at 04:11, Jeff King <peff@peff.net> wrote:
Show 21 quoted lines
> On Mon, Jul 24, 2017 at 02:58:38PM +1000, Andrew Ardill wrote:
>
>> On 24 July 2017 at 13:45, Farshid Zavareh <fhzavareh@gmail.com> wrote:
>> > I'll probably test this myself, but would modifying and committing a 4GB
>> > text file actually add 4GB to the repository's size? I anticipate that it
>> > won't, since Git keeps track of the changes only, instead of storing a copy
>> > of the whole file (whereas this is not the case with binary files, hence the
>> > need for LFS).
>>
>> I decided to do a little test myself. I add three versions of the same
>> data set (sometimes slightly different cuts of the parent data set,
>> which I don't have) each between 2 and 4GB in size.
>> Each time I added a new version it added ~500MB to the repository, and
>> operations on the repository took 35-45 seconds to complete.
>> Running `git gc` compressed the objects fairly well, saving ~400MB of
>> space. I would imagine that even more space would be saved
>> (proportionally) if there were a lot more similar files in the repo.
>
> Did you tweak core.bigfilethreshold? Git won't actually try to find
> deltas on files larger than that (500MB by default). So you might be
> seeing just the effects of zlib compression, and not deltas.
I tweaked nothing!

The space saving I assumed was pretty much just zlib compression, and I wasn't sure how much delta we actually could get, and how long that might take to run.

Show 9 quoted lines
> You can always check the delta status after a gc by running:
>
>   git rev-list --objects --all |
>   git cat-file --batch-check='%(objectsize:disk) %(objectsize) %(deltabase) %(rest)'
>
> That should give you a sense of how much you're saving due to zlib (by
> comparing the first two numbers for a copy that isn't a delta; i.e.,
> with an all-zeros delta base) and how much due to deltas (how much
> smaller the first number is for an entry that _is_ a delta).
Let's have a look:
$ git rev-list --objects --all |
  git cat-file --batch-check='%(objectsize:disk) %(objectsize)
%(deltabase) %(rest)'
174 262 0000000000000000000000000000000000000000
171 260 0000000000000000000000000000000000000000
139 212 0000000000000000000000000000000000000000
47 36 0000000000000000000000000000000000000000
377503831 2310238304 0000000000000000000000000000000000000000 data.txt
47 36 0000000000000000000000000000000000000000
500182546 3740427683 0000000000000000000000000000000000000000 data.txt
47 36 0000000000000000000000000000000000000000
447340264 3357717475 0000000000000000000000000000000000000000 data.txt
Yep, all zlib.

What do you think is a reasonable config for storing text files this large, to get good delta compression, or is it more of a trial and error to find out what works best?

Regards,
Andrew Ardill
Previous: Junio C HamanoNext: Jeff King
Message 10 of 14 in “Should I store large text files on Git LFS?”
  1. Farshid ZavarehJul 24, 2017
  2. Andrew ArdillJul 24, 2017
  3. Farshid ZavarehJul 24, 2017
  4. David LangJul 24, 2017
  5. Farshid ZavarehJul 24, 2017
  6. David LangJul 24, 2017
  7. Andrew ArdillJul 24, 2017
  8. Jeff KingJul 24, 2017
  9. Junio C HamanoJul 24, 2017
  10. Andrew ArdillJul 25, 2017
  11. Jeff KingJul 25, 2017
  12. Junio C HamanoJul 25, 2017
  13. Jeff KingJul 25, 2017
  14. Stefan BellerJul 25, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.