Go并行gzip壓縮:pgzip

jopen 11年前發布 | 27K 次閱讀 pgzip Google Go/Golang開發

Go并行gzip壓縮。它完全兼容gzip可直接替換 "compress/gzip"。它將待壓縮內容拆分成多塊然后并行壓縮,對于大數據量壓縮非常好用。

var b bytes.Buffer
w := gzip.NewWriter(&b)
w.SetConcurrency(100000, 10)
w.Write([]byte("hello, world\n"))
w.Close()

性能比較

Compression cost is usually about 0.2% with default settings with a block size of 250k.

Example with GOMAXPROC set to 4 (dual core with 2 hyperthreads)

Compressor MB/sec speedup size size overhead
gzip (golang) 15.082MB/s 1.0x 6.405.193 0%
pgzip (golang) 26.736MB/s 1.8x 6.421.585 0.2%
bgzf (golang) 29.525MB/s 1.9x 6.875.913 7.3%


項目主頁:http://www.baiduhome.net/lib/view/home/1413516367512

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!