https://github.com/endel/fossildelta
An efficient delta compression algorithm written in C#
https://github.com/endel/fossildelta
compression delta fossil-scm
Last synced: about 1 year ago
JSON representation
An efficient delta compression algorithm written in C#
- Host: GitHub
- URL: https://github.com/endel/fossildelta
- Owner: endel
- License: other
- Created: 2016-09-25T20:47:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-02-22T20:12:33.000Z (over 6 years ago)
- Last Synced: 2025-04-12T20:07:56.049Z (about 1 year ago)
- Topics: compression, delta, fossil-scm
- Language: C#
- Homepage: https://www.fossil-scm.org/index.html/doc/trunk/www/delta_format.wiki
- Size: 81.1 KB
- Stars: 112
- Watchers: 7
- Forks: 13
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Delta compression algorithm for C#
===
[](https://travis-ci.org/endel/FossilDelta)
> This is a port from the original C implementation. See references below.
Fossil achieves efficient storage and low-bandwidth synchronization through the
use of delta-compression. Instead of storing or transmitting the complete
content of an artifact, fossil stores or transmits only the changes relative to
a related artifact.
* [Format](http://www.fossil-scm.org/index.html/doc/tip/www/delta_format.wiki)
* [Algorithm](http://www.fossil-scm.org/index.html/doc/tip/www/delta_encoder_algorithm.wiki)
* [Original implementation](http://www.fossil-scm.org/index.html/artifact/f3002e96cc35f37b)
Other implementations:
- [Haxe](https://github.com/endel/fossil-delta-hx)
- [Python](https://github.com/ggicci/python-fossil-delta)
- [JavaScript](https://github.com/dchest/fossil-delta-js) ([Online demo](https://dchest.github.io/fossil-delta-js/))
Installation
---
### NuGet Gallery
FossilDelta is available on the [NuGet Gallery](https://www.nuget.org/packages).
- [NuGet Gallery: FossilDelta](https://www.nuget.org/packages/FossilDelta)
You can add FossilDelta to your project with the **NuGet Package Manager**, by using the following command in the **Package Manager Console**.
PM> Install-Package FossilDelta
Usage
---
### Fossil.Delta.Create(byte[] origin, byte[] target)
Returns the difference between `origin` and `target` as a byte array (`byte[]`)
### Fossil.Delta.Apply(byte[] origin, byte[] delta)
Apply the `delta` patch on `origin`, returning the final value as byte array
(`byte[]`).
Throws an error if it fails to apply the delta
(e.g. if it was corrupted).
### Fossil.Delta.OutputSize(byte[] delta)
Returns a size of target for this delta.
Throws an error if it can't read the size from delta.
Benchmark
---
[See the inputs used for benchmarking](Tests/data). Run the benchmarks
locally using the `make benchmark` in your commandline.
**Results:**
```
Method | Mean | StdErr | StdDev | Median |
------------- |--------------- |-------------- |--------------- |--------------- |
CreateDelta1 | 5,426.4132 ns | 787.5304 ns | 6,201.0206 ns | 4,286.4851 ns |
CreateDelta2 | 21,837.1107 ns | 1,661.4695 ns | 13,900.8509 ns | 25,942.1491 ns |
CreateDelta3 | 11,697.2018 ns | 1,213.1634 ns | 12,607.5636 ns | 9,260.4452 ns |
CreateDelta4 | 253.4085 ns | 25.1048 ns | 214.4952 ns | 252.6454 ns |
CreateDelta5 | 150.4963 ns | 29.0635 ns | 311.6718 ns | 0.0000 ns |
ApplyDelta1 | 3,547.0234 ns | 493.4131 ns | 4,357.7065 ns | 3,086.8397 ns |
ApplyDelta2 | 20,336.7691 ns | 2,488.0257 ns | 27,254.9560 ns | 9,233.5811 ns |
ApplyDelta3 | 1,441.5354 ns | 209.2071 ns | 1,995.7090 ns | 855.9650 ns |
ApplyDelta4 | 252.5743 ns | 29.7323 ns | 234.1123 ns | 236.0480 ns |
ApplyDelta5 | 68.5550 ns | 9.2923 ns | 92.4574 ns | 39.0918 ns |
```