From 312ea32bb70abb93be315d0b7c442d5c4ae571d9 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Wed, 16 Aug 2017 18:33:00 +0200 Subject: cryptocore: add urandom + randprefetch benchmarks The benchmark that supported the decision for 512-byte prefetching previously lived outside the repo. Let's add it where it belongs so it cannot get lost. --- internal/cryptocore/randprefetch_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'internal/cryptocore/randprefetch_test.go') diff --git a/internal/cryptocore/randprefetch_test.go b/internal/cryptocore/randprefetch_test.go index 2a568f3..b263ef3 100644 --- a/internal/cryptocore/randprefetch_test.go +++ b/internal/cryptocore/randprefetch_test.go @@ -38,3 +38,11 @@ func TestRandPrefetch(t *testing.T) { t.Errorf("random data should be incompressible, but: in=%d compressed=%d\n", p*l*l, b.Len()) } } + +func BenchmarkRandPrefetch(b *testing.B) { + // 16-byte nonces are default since gocryptfs v0.7 + b.SetBytes(16) + for i := 0; i < b.N; i++ { + randPrefetcher.read(16) + } +} -- cgit v1.2.3