diff options
author | Jakob Unterwurzacher | 2020-04-19 21:34:45 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2020-04-19 21:35:06 +0200 |
commit | fcdeb52390b15b0d59015dbd238835b9a6f6b3ff (patch) | |
tree | 899e67239595160599f57c988f20839819385a80 /internal/inomap/inomap_test.go | |
parent | 1c169ac55e79acb098c858a0448b9f30a4620a98 (diff) |
inomap: add benchmark
$ go test -bench=.
goos: linux
goarch: amd64
pkg: github.com/rfjakob/gocryptfs/internal/inomap
BenchmarkTranslateSingleDev-4 202479382 5.88 ns/op
BenchmarkTranslateManyDevs-4 16095795 71.9 ns/op
PASS
ok github.com/rfjakob/gocryptfs/internal/inomap 3.039s
Diffstat (limited to 'internal/inomap/inomap_test.go')
-rw-r--r-- | internal/inomap/inomap_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/inomap/inomap_test.go b/internal/inomap/inomap_test.go index 3c0ea7d..0349fd6 100644 --- a/internal/inomap/inomap_test.go +++ b/internal/inomap/inomap_test.go @@ -79,3 +79,22 @@ func TestTranslateStress(t *testing.T) { t.Fail() } } + +func BenchmarkTranslateSingleDev(b *testing.B) { + m := New(0) + var q QIno + for n := 0; n < b.N; n++ { + q.Ino = uint64(n % 1000) + m.Translate(q) + } +} + +func BenchmarkTranslateManyDevs(b *testing.B) { + m := New(0) + var q QIno + for n := 0; n < b.N; n++ { + q.Dev = uint64(n % 10) + q.Ino = uint64(n % 1000) + m.Translate(q) + } +} |