The rolling version of adler32 is just a wrapper around the standard hash/adler32 when used in a non-rolling fashion, but it's inefficient as it allocates a new hash instance for every Write(). This uses the default version instead in the block hasher, and adds a test to verify the result is the same as they were before. It reduces allocations by 88% and increases speed about 5%. benchmark old ns/op new ns/op delta BenchmarkHashFile-8 64434698 61303647 -4.86% benchmark old MB/s new MB/s speedup BenchmarkHashFile-8 276.65 290.78 1.05x benchmark old allocs new allocs delta BenchmarkHashFile-8 1238 150 -87.88% benchmark old bytes new bytes delta BenchmarkHashFile-8 17877363 49292 -99.72% |
||
---|---|---|
.. | ||
testdata | ||
.gitignore | ||
blockqueue.go | ||
blocks_test.go | ||
blocks.go | ||
debug.go | ||
doc.go | ||
walk_test.go | ||
walk.go |