Average taken over 20 cycles each of compression and decompression, in Debug build with debugger attached. This is to purposefully slow it down so that efficiency improvements are more noticable.
Percentage improvement figures are between current and previous benchmark rather than current and first.
Compression: 382 ms
Decompression: 367 ms
Removing division and modulus from BitReader class.
https://github.com/stevehjohn/Huffman/commit/6771779f9f2177d2514f6a7323e992cdde1b3a4b
Compression: 384 ms
Decompression: 355 ms ↓ ~3.3%
Removing modulus from Blob class.
https://github.com/stevehjohn/Huffman/commit/f3f3e26fbc06a8a656b1a4def72c38fb95b42bc9
Compression: 373 ms ↓ ~2.9%
Decompression: 362 ms
Replacing List<byte>
with byte[]
in Blob class.
https://github.com/stevehjohn/Huffman/commit/d59b6940013c5501fbf5a4132f0ea1ac3345ef43
Compression: 300 ms ↓ ~19.6%
Decompression: 366 ms
Removing calls to OriginalLength
property.
https://github.com/stevehjohn/Huffman/commit/df95e5f2761aa6bd3ade70ad8c7385b6ea48c362
Compression: 307 ms
Decompression: 327 ms ↓ ~10.7%
Replace foreach
loop with for
loop over input string.
https://github.com/stevehjohn/Huffman/commit/4dfd629f3aae1d5da4c2a849576038db81d7bfcd
Compression: 298 ms ↓ ~2.9%
Decompression: 327 ms
Replace StringBuilder
with char[]
.
https://github.com/stevehjohn/Huffman/commit/84cab7ab81a0c966abe8b639a8fa08e54480416a
Compression: 298 ms
Decompression: 315 ms ↓ ~3.7%
Pre-build path cache.
https://github.com/stevehjohn/Huffman/commit/35c38a44d6c7b57882ee742893ab8c109870fb22
Compression: 291 ms ↓ ~2.3%
Decompression: 315 ms
Pre-build path cache into array rather than dictionary.
https://github.com/stevehjohn/Huffman/commit/e2651dd774fcff428542ad1eb10fb3ba1c479480
Compression: 275 ms ↓ ~5.5%
Decompression: 315 ms
Tweaking BitReader
.
https://github.com/stevehjohn/Huffman/commit/71807f6443cc727389e8a414303834004592e4f2
No discernable difference.
Reduce dereferencing of _data
in BitReader
.
https://github.com/stevehjohn/Huffman/commit/5203d0bc473f1742a9d7a782a49029c781370839
Compression: 267 ms
Decompression: 293 ms ↓ ~7.0%
Using pointers to access the input string when compressing.
https://github.com/stevehjohn/Huffman/commit/f42ae728c90a8284a926b31841a8374ceb3a9ead
Compression: 245 ms ↓ ~8.2%
Decompression: 293 ms
Improving efficiency of BitReader.
https://github.com/stevehjohn/Huffman/commit/875ac6182219f8d01e3ad8c24ec797e8bb76c317
Compression: 245 ms
Decompression: 268 ms ↓ ~8.5%
Initial Time | Latest Time | % Improvement | |
---|---|---|---|
Compression: | 382 ms | 245 ms | 35.9% |
Decompression: | 367 ms | 268 ms | 30.0% |