Merge pull request #1 from wangtuanjie/master

benchmark compare to std
tree: d2b67f3cc22fcfd3ae92041b7dc21e1c72256075
  1. .gitignore
  2. .travis.yml
  3. crc32.go
  4. crc32_amd64.s
  5. crc32_amd64p32.s
  6. crc32_amd64x.go
  7. crc32_generic.go
  8. crc32_test.go
  9. LICENSE
  10. README.md
README.md

crc32

CRC32 hash with x64 optimizations

This package is a drop-in replacement for the standard library hash/crc32 package, that features SSE 4.2 optimizations on x64 platforms, for a 10x speedup.

usage

Install using go get github.com/klauspost/crc32. This library is based on Go 1.4.2 code and requires Go 1.3 or newer.

Replace import "hash/crc32" with import "github.com/klauspost/crc32" and you are good to go.

performance

For IEEE tables (the most common), there is approximately a factor 10 speedup with SSE 4.2:

benchmark            old ns/op     new ns/op     delta
BenchmarkCrc32KB     99955         10258         -89.74%

benchmark            old MB/s     new MB/s     speedup
BenchmarkCrc32KB     327.83       3194.20      9.74x

For other tables and non-SSE 4.2 the peformance is the same as the standard library.

license

Standard Go license. Changes are Copyright (c) 2015 Klaus Post under same conditions.