Hello there,
I kind of need a good compression library but it turns out that the golang implementation of
snappy is really slow. Encode speed is in the order of 100MB/s while the decode speed is in the order of 200MB/s. This way below the
wiki claim "Compression speed is 250
MB/s and decompression speed is 500 MB/s" .
I read an earlier post in the forum regarding this issue
https://groups.google.com/forum/#!topic/golang-dev/g2m2v081nxU . However, there isn't any clear conclusion to me. I tried to use Snappy to minimize disk and network overhead, but 100MB/s is even slower than HDD disks.
Have any one get some good ideas regarding what compression I should use in golang for better speed?
Thank you so much for help!
Cheers,
Eric
Here is the benchmark results in my single thread Intel E5-2620 2.00GHz
go version go1.2rc5 linux/amd64
snappy]$ go test -bench=.
PASS
BenchmarkWordsDecode1e3-24 500000 3369 ns/op 296.77 MB/s
BenchmarkWordsDecode1e4-24 50000 58917 ns/op 169.73 MB/s
BenchmarkWordsDecode1e5-24 2000 752878 ns/op 132.82 MB/s
BenchmarkWordsDecode1e6-24 500 7454509 ns/op 134.15 MB/s
BenchmarkWordsEncode1e3-24 100000 17999 ns/op 55.56 MB/s
BenchmarkWordsEncode1e4-24 10000 123028 ns/op 81.28 MB/s
BenchmarkWordsEncode1e5-24 2000 1476329 ns/op 67.74 MB/s
BenchmarkWordsEncode1e6-24 100 14422396 ns/op 69.34 MB/s
Benchmark_UFlat0-24 5000 403891 ns/op 253.53 MB/s
Benchmark_UFlat1-24 500 3294375 ns/op 213.12 MB/s
Benchmark_UFlat2-24 100000 17165 ns/op 7396.28 MB/s
Benchmark_UFlat3-24 10000 109116 ns/op 864.49 MB/s
Benchmark_UFlat4-24 1000 1631508 ns/op 251.06 MB/s
Benchmark_UFlat5-24 10000 117094 ns/op 210.11 MB/s
Benchmark_UFlat6-24 50000 51696 ns/op 215.68 MB/s
Benchmark_UFlat7-24 200000 12573 ns/op 295.94 MB/s
Benchmark_UFlat8-24 500 4613290 ns/op 223.21 MB/s
Benchmark_UFlat9-24 2000 1162495 ns/op 130.83 MB/s
Benchmark_UFlat10-24 2000 974933 ns/op 128.40 MB/s
Benchmark_UFlat11-24 500 3138411 ns/op 135.98 MB/s
Benchmark_UFlat12-24 500 3909131 ns/op 123.27 MB/s
Benchmark_UFlat13-24 1000 1823203 ns/op 281.49 MB/s
Benchmark_UFlat14-24 10000 193647 ns/op 197.47 MB/s
Benchmark_UFlat15-24 200000 14538 ns/op 290.74 MB/s
Benchmark_UFlat16-24 5000 397661 ns/op 298.21 MB/s
Benchmark_UFlat17-24 2000 1128084 ns/op 163.39 MB/s
Benchmark_ZFlat0-24 5000 675178 ns/op 151.66 MB/s
Benchmark_ZFlat1-24 200 9186338 ns/op 76.43 MB/s
Benchmark_ZFlat2-24 1000 2216938 ns/op 57.27 MB/s
Benchmark_ZFlat3-24 2000 1448770 ns/op 65.11 MB/s
Benchmark_ZFlat4-24 1000 2635193 ns/op 155.43 MB/s
Benchmark_ZFlat5-24 10000 290330 ns/op 84.74 MB/s
Benchmark_ZFlat6-24 10000 101738 ns/op 109.60 MB/s
Benchmark_ZFlat7-24 50000 36105 ns/op 103.06 MB/s
Benchmark_ZFlat8-24 200 7907748 ns/op 130.22 MB/s
Benchmark_ZFlat9-24 1000 2254462 ns/op 67.46 MB/s
Benchmark_ZFlat10-24 1000 1962675 ns/op 63.78 MB/s
Benchmark_ZFlat11-24 500 6062985 ns/op 70.39 MB/s
Benchmark_ZFlat12-24 200 7805806 ns/op 61.73 MB/s
Benchmark_ZFlat13-24 500 3007613 ns/op 170.64 MB/s
Benchmark_ZFlat14-24 5000 481279 ns/op 79.45 MB/s
Benchmark_ZFlat15-24 50000 45099 ns/op 93.73 MB/s
Benchmark_ZFlat16-24 5000 685679 ns/op 172.95 MB/s
Benchmark_ZFlat17-24 1000 1862138 ns/op 98.98 MB/s
ok
code.google.com/p/snappy-go/snappy 105.189s