]> Cypherpunks repositories - gostls13.git/commit
hash/crc32: speedup crc32 of IEEE using slicingBy8
authorDavies Liu <davies.liu@gmail.com>
Fri, 19 Dec 2014 06:45:55 +0000 (22:45 -0800)
committerRuss Cox <rsc@golang.org>
Thu, 18 Jun 2015 18:14:24 +0000 (18:14 +0000)
commit1e0760354c8a929d9d84575106ae264fa6395132
treecfd07e2eb43c0153e03155134d1cfd59ab974f01
parentd1e7980d1b25b5446bee9a9fc0b53eddd899718a
hash/crc32: speedup crc32 of IEEE using slicingBy8

The Slicing-By-8 [1] algorithm has much performance improvements than
current approach. This patch only uses it for IEEE, which is the most
common case in practice.

There is the benchmark on Mac OS X 10.9:

benchmark                     old MB/s     new MB/s     speedup
BenchmarkIEEECrc1KB           349.40       353.03       1.01x
BenchmarkIEEECrc4KB           351.55       934.35       2.66x
BenchmarkCastagnoliCrc1KB     7037.58      7392.63      1.05x

This algorithm need 8K lookup table, so it's enabled only for block
larger than 4K.

We can see about 2.6x improvement for IEEE.

Change-Id: I7f786d20f0949245e4aa101d7921669f496ed0f7
Reviewed-on: https://go-review.googlesource.com/1863
Reviewed-by: Russ Cox <rsc@golang.org>
src/hash/crc32/crc32.go
src/hash/crc32/crc32_test.go