[Pkg-privacy-commits] [golang-siphash-dev] 20/23: Simplify counting of message bytes.
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 12:55:54 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository golang-siphash-dev.
commit 42ba037e748c9062a75e0924705c43b893edefcd
Author: Dmitry Chestnykh <dmitry at codingrobots.com>
Date: Fri Jan 25 14:45:21 2013 +0100
Simplify counting of message bytes.
benchmark old ns/op new ns/op delta
BenchmarkFull8 100 100 +0.00%
BenchmarkFull16 120 114 -5.00%
BenchmarkFull40 115 113 -1.74%
BenchmarkFull64 220 214 -2.73%
BenchmarkFull128 220 216 -1.82%
BenchmarkFull1K 2054 2007 -2.29%
BenchmarkFull8K 16102 15581 -3.24%
benchmark old MB/s new MB/s speedup
BenchmarkFull8 79.73 79.41 1.00x
BenchmarkFull16 132.42 139.21 1.05x
BenchmarkFull40 208.42 210.75 1.01x
BenchmarkFull64 290.55 298.00 1.03x
BenchmarkFull128 579.46 592.46 1.02x
BenchmarkFull1K 498.53 510.12 1.02x
BenchmarkFull8K 508.73 525.76 1.03x
---
siphash.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/siphash.go b/siphash.go
index a8d73a0..89d40ad 100644
--- a/siphash.go
+++ b/siphash.go
@@ -103,7 +103,6 @@ func blocks(d *digest, p []uint8) {
v0 ^= m
p = p[BlockSize:]
- d.t += BlockSize
}
d.v0, d.v1, d.v2, d.v3 = v0, v1, v2, v3
@@ -111,6 +110,7 @@ func blocks(d *digest, p []uint8) {
func (d *digest) Write(p []byte) (nn int, err error) {
nn = len(p)
+ d.t += uint8(nn)
if d.nx > 0 {
n := len(p)
if n > BlockSize-d.nx {
@@ -141,7 +141,7 @@ func (d0 *digest) Sum64() uint64 {
for i := d.nx; i < BlockSize-1; i++ {
d.x[i] = 0
}
- d.x[7] = d.t + uint8(d.nx)
+ d.x[7] = d.t
blocks(&d, d.x[:])
v0, v1, v2, v3 := d.v0, d.v1, d.v2, d.v3
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/golang-siphash-dev.git
More information about the Pkg-privacy-commits
mailing list