summaryrefslogtreecommitdiff
path: root/internal/cryptocore/randprefetch_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-08-16 18:33:00 +0200
committerJakob Unterwurzacher2017-08-16 18:33:00 +0200
commit312ea32bb70abb93be315d0b7c442d5c4ae571d9 (patch)
tree31c7b91db06bf208a6d44dae0058171dd6735b80 /internal/cryptocore/randprefetch_test.go
parent838bf883df579a414289a3e05d238c582ac78523 (diff)
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.
Diffstat (limited to 'internal/cryptocore/randprefetch_test.go')
-rw-r--r--internal/cryptocore/randprefetch_test.go8
1 files changed, 8 insertions, 0 deletions
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)
+ }
+}