diff options
| author | Josh Bleecher Snyder <josh@tailscale.com> | 2021-05-07 18:05:04 -0700 |
|---|---|---|
| committer | Josh Bleecher Snyder <josharian@gmail.com> | 2021-05-11 11:33:17 -0700 |
| commit | 7891b34266728fcfd0c82f8d76a183ebb84981ef (patch) | |
| tree | 685c13c9caf20aa7b1228874dcbbd9e808b07910 | |
| parent | cb97062baca55dc5ce7ca4bd5cbbc5cd738363ca (diff) | |
| download | tailscale-7891b34266728fcfd0c82f8d76a183ebb84981ef.tar.xz tailscale-7891b34266728fcfd0c82f8d76a183ebb84981ef.zip | |
internal/deepprint: add BenchmarkHash
deepprint currently accounts for 15% of allocs in tailscaled.
This is a useful benchmark to have.
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
| -rw-r--r-- | internal/deepprint/deepprint_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/deepprint/deepprint_test.go b/internal/deepprint/deepprint_test.go index d7576f27a..0b2d25423 100644 --- a/internal/deepprint/deepprint_test.go +++ b/internal/deepprint/deepprint_test.go @@ -62,3 +62,11 @@ func getVal() []interface{} { }, } } + +func BenchmarkHash(b *testing.B) { + b.ReportAllocs() + v := getVal() + for i := 0; i < b.N; i++ { + Hash(v) + } +} |
