diff --git a/.last_go_version b/.last_go_version index 531e0b896..1055b8669 100644 --- a/.last_go_version +++ b/.last_go_version @@ -1 +1 @@ -6g version weekly.2011-06-02 8633+ +6g version weekly.2011-05-22 8613+ diff --git a/lib/go/camli/rollsum/rollsum.go b/lib/go/camli/rollsum/rollsum.go index 6fec3f52b..0c6b07b90 100644 --- a/lib/go/camli/rollsum/rollsum.go +++ b/lib/go/camli/rollsum/rollsum.go @@ -16,6 +16,9 @@ limitations under the License. // Package rollsum implements rolling checksums similar to apenwarr's bup, which // is similar to librsync. +// +// The bup project is at https://github.com/apenwarr/bup and its splitting in +// particular is at https://github.com/apenwarr/bup/blob/master/lib/bup/bupsplit.c package rollsum import ( diff --git a/lib/go/camli/rollsum/rollsum_test.go b/lib/go/camli/rollsum/rollsum_test.go index 0993fdce4..728bed688 100644 --- a/lib/go/camli/rollsum/rollsum_test.go +++ b/lib/go/camli/rollsum/rollsum_test.go @@ -53,3 +53,19 @@ func TestSum(t *testing.T) { t.Errorf("sum3a=%d sum3b=%d", sum3a, sum3b) } } + +func BenchmarkRollsum(b *testing.B) { + bytesSize := int64(1024 * 1024 * 5) + rs := New() + bits := 0 + for i := 0; i < b.N; i++ { + for j := int64(0); j < bytesSize; j++ { + rs.Roll(byte(rand.Int63() & 0xff)) + if rs.OnSplit() { + bits = rs.Bits() + } + } + } + b.SetBytes(bytesSize) + _ = bits +}