Excellent library! (more accurate benchmarks included)

Jun 28, 2011 at 10:36 AM
Edited Oct 19, 2011 at 3:02 PM

Hi!

C# LZF is an excellent piece of code!
Special thanks for the BSD-style licensing conditions.

Although the original benchmarks seem to be not quite accurate, LZF's real numbers still look quite competitive:

Library Textual data, 100000 bytes Binary data, 111190 bytes Uncompressible data, 100066 bytes
Compressed size, bytes Compression speed, mb/c Decompression speed, mb/s Compressed size, bytes Compression speed, mb/s Decompression speed, mb/s Compressed size, bytes Compression speed, mb/s Decompression speed, mb/s
LZF 71216 28 47 74333 29 43 103187 24 160
QuickLZ 1.5.0 59508 54 22 85842 32 19 100075 67 997
DeflateStream 44016 6 9 47044 7 8 100196 12 401

LZF is usually several times faster than .NET built-in DeflateStream.
LZF's decompression is almost twice as fast as QuickLZ's 1.5.0 decompression.

Congratulations! Keep up the good work.

Jun 28, 2011 at 10:51 AM
Edited Jun 28, 2011 at 11:00 PM

Here is my benchmark code: http://sharp-shooter.ru/misc/bench.cs 

Syntax highlighted version at PasteBin: http://pastebin.com/0kYtVRpR 

Benchmark output on my machines:

Cpu: Intel(R) Core(TM) i5 CPU M 430 @ 2.27GHz
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
Running in 64-bit process: yes

Generating test data...
Binary: 111190 bytes.
Textual: 100000 bytes.
Uncompressible: 100066 bytes.

Benchmark name: LZF, binary data
Compression:    size: 111190 ->  74333, elapsed: 00:00:18.8671109, speed: 29,467 mb/s
Decompression:  size:  74333 -> 111190, elapsed: 00:00:08.6984298, speed: 42,728 mb/s

Benchmark name: QuickLZ, binary data
Compression:    size: 111190 ->  85842, elapsed: 00:00:17.2383039, speed: 32,251 mb/s
Decompression:  size:  85842 -> 111190, elapsed: 00:00:22.6606130, speed: 18,941 mb/s

Benchmark name: DeflateStream, binary data
Compression:    size: 111190 ->  47044, elapsed: 00:01:21.6304364, speed: 6,811 mb/s
Decompression:  size:  47044 -> 111190, elapsed: 00:00:27.4391230, speed: 8,572 mb/s

Benchmark name: LZF, textual data
Compression:    size: 100000 ->  71216, elapsed: 00:00:18.1162607, speed: 27,600 mb/s
Decompression:  size:  71216 -> 100000, elapsed: 00:00:07.5783367, speed: 46,987 mb/s

Benchmark name: QuickLZ, textual data
Compression:    size: 100000 ->  59508, elapsed: 00:00:09.2127681, speed: 54,273 mb/s
Decompression:  size:  59508 -> 100000, elapsed: 00:00:13.2525378, speed: 22,452 mb/s

Benchmark name: DeflateStream, textual data
Compression:    size: 100000 ->  44016, elapsed: 00:01:17.9987857, speed: 6,410 mb/s
Decompression:  size:  44016 -> 100000, elapsed: 00:00:23.5485619, speed: 9,346 mb/s

Benchmark name: LZF, uncompressible data
Compression:    size: 100066 -> 103187, elapsed: 00:00:21.2345259, speed: 23,562 mb/s
Decompression:  size: 103187 -> 100066, elapsed: 00:00:03.2150996, speed: 160,472 mb/s

Benchmark name: QuickLZ, uncompressible data
Compression:    size: 100066 -> 100075, elapsed: 00:00:07.4476541, speed: 67,180 mb/s
Decompression:  size: 100075 -> 100066, elapsed: 00:00:00.5020522, speed: 996,659 mb/s

Benchmark name: DeflateStream, uncompressible data
Compression:    size: 100066 -> 100196, elapsed: 00:00:40.3057956, speed: 12,413 mb/s
Decompression:  size: 100196 -> 100066, elapsed: 00:00:01.2486090, speed: 401,230 mb/s


Cpu: AMD Athlon(tm) 64 X2 Dual Core Processor 4000+ Operating System: Microsoft Windows NT 5.1.2600 Service Pack 3 Running in 64-bit process: no Generating test data... Binary: 111190 bytes. Textual: 100000 bytes. Uncompressible: 100066 bytes. Benchmark name: LZF, binary data Compression: size: 111190 -> 74333, elapsed: 00:00:20.2113888, speed: 27,507 mb/s Decompression: size: 74333 -> 111190, elapsed: 00:00:06.9909421, speed: 53,164 mb/s Benchmark name: QuickLZ, binary data Compression: size: 111190 -> 85842, elapsed: 00:00:15.4923307, speed: 35,885 mb/s Decompression: size: 85842 -> 111190, elapsed: 00:00:13.6885936, speed: 31,355 mb/s Benchmark name: DeflateStream, binary data Compression: size: 111190 -> 47044, elapsed: 00:01:02.6809806, speed: 8,870 mb/s Decompression: size: 47044 -> 111190, elapsed: 00:00:21.7394453, speed: 10,820 mb/s Benchmark name: LZF, textual data Compression: size: 100000 -> 71216, elapsed: 00:00:18.4145160, speed: 27,152 mb/s Decompression: size: 71216 -> 100000, elapsed: 00:00:06.4822590, speed: 54,931 mb/s Benchmark name: QuickLZ, textual data Compression: size: 100000 -> 59508, elapsed: 00:00:07.8205288, speed: 63,934 mb/s Decompression: size: 59508 -> 100000, elapsed: 00:00:09.9149411, speed: 30,009 mb/s Benchmark name: DeflateStream, textual data Compression: size: 100000 -> 44016, elapsed: 00:01:04.0464584, speed: 7,807 mb/s Decompression: size: 44016 -> 100000, elapsed: 00:00:21.2091553, speed: 10,377 mb/s Benchmark name: LZF, uncompressible data Compression: size: 100066 -> 103187, elapsed: 00:00:29.4804557, speed: 16,972 mb/s Decompression: size: 103187 -> 100066, elapsed: 00:00:02.9990116, speed: 172,035 mb/s Benchmark name: QuickLZ, uncompressible data Compression: size: 100066 -> 100075, elapsed: 00:00:08.3579703, speed: 59,863 mb/s Decompression: size: 100075 -> 100066, elapsed: 00:00:01.1251642, speed: 444,713 mb/s Benchmark name: DeflateStream, uncompressible data Compression: size: 100066 -> 100196, elapsed: 00:00:37.5344123, speed: 13,330 mb/s Decompression: size: 100196 -> 100066, elapsed: 00:00:02.2705941, speed: 220,638 mb/s