Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How well does Git LFS handle small files?

Is there a best practice for the type files stored in Git LFS? Specifically for the minimum size?

For instance, a 10mb music file would be a obvious fit, but what about a 25kb png? Is it worth putting in LFS or it better to just let Git handle it?

My concern is performance degradation when checking too many small files into an LFS repo. Is there any data on how the LFS extension stands up to a bunch of smaller binary files? Is it advisable to only store files over a certain size threshold?

like image 844
James McMahon Avatar asked Mar 04 '16 02:03

James McMahon


People also ask

Does Git LFS reduce size?

Git LFS does not compress files. Some files are compressible, and some are not. It, like Git's partial clone feature, is designed to offload most of the data to a trusted server for the purposes of making local access lighter and cheaper.

Does Git LFS have a limit?

GitHub has a file size limit of 100mb for a single file, and oftentimes in game development we may need to push files above this limit.

What is Git LFS good for?

Git LFS (Large File Storage) is a Git extension developed by Atlassian, GitHub, and a few other open source contributors, that reduces the impact of large files in your repository by downloading the relevant versions of them lazily.

Should you use LFS?

Should I Use Git LFS? You should use Git LFS if you have large files or binary files to store in Git repositories. That's because Git is decentralized. So, every developer has the full change history on their computer.


1 Answers

I would not expect a an exact threshold value being given.

LFS saves on the amount of data the needs to be exchanged for for synchronizing with a remote repository. However, the saving only applies as long as the large file itself is not changing. Actually for a changed file you would need a second rountrip to process the change on an LFS object.

So, you may include smaller files with LFS if in your use case those are not changing (frequently). The specific break even will depend on the I/O speed of the server and mostly on the latency and throughput between repository and client.

In your example, I'd still expect improvements in case the pngs are close to never changing. As soon as they are going to change (almost) on each and every commit even larger files might not benefit from being put to LFS.

Also the extra cost of second round trip will become less and less important the larger the typical files will be. Especially when the size of a file class (suffix) will vary over a broad range and/or the change frequency within a file class is covering a wide spectrum there might not be a clear answer to your question.

like image 136
rpy Avatar answered Sep 22 '22 16:09

rpy