I am planning to build a version control system to learn some advanced programming concepts in the process.

I've used git , perforce and svn.

I was wondering if any of them or other uses delta uploads and download like syncing only changes for individual files instead of entire files.

  • 1
    Mandatory comment: I don't think that it makes sense to implement your own version control system today. Seriously, if you do it correctly, you will end up with a design very similar to git. Why reinvent the wheel? – juhist Mar 10 '17 at 16:00
  • @juhist there's quite a lot to be desired from git, such as sending and receiving only deltas on sync and file lock signalling for non-mergable binary files – Allahjane Mar 10 '17 at 16:08
  • What benefits would be obtained by having those additional features? – Robert Harvey Mar 10 '17 at 17:10
  • @RobertHarvey well transferring only deltas can reduce the bandwidth usage tremendously for large files that are updated frequently with small changes and an option to lock or flag a non mergable file would prevent people stepping on each others toes – Allahjane Mar 11 '17 at 17:35
  • Git is already pretty fast, and bandwidth is cheap. I love the idea of a lock flag, however. – Robert Harvey Mar 11 '17 at 17:42

Git compresses data into packfiles. So, even though in theory git is a storage mechanism for whole objects, in practice the objects are delta-compressed.

You can learn more about these packfiles from e.g. https://git-scm.com/book/en/v2/Git-Internals-Packfiles

The packing mechanism finds files that are similarly named in different versions, and have a size reasonably close to each other. It then concludes that these files are a good candidate for trying delta-compression, and the delta-compression is used if it had a measurable gain. If you change the entire contents of a file, git may conclude that delta-compression is not beneficial, and thus, the file is stored as-is. This differs significantly from older version control systems such as CVS (and perhaps SVN?) that always use delta-compression where the newest version of a file is stored as-is and the older versions are just the newest version minus deltas.

The delta-compression mechanism in git is able to utilize all CPU cores in the system by multithreading.

  • well yeah , and how about transferring those as deltas only too? – Allahjane Mar 10 '17 at 16:07
  • I think you'll find Git does that too: the packing mechanism is used not only for storage, but also for data transfers. – juhist Mar 10 '17 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.