From 527364fabf3dab18b8039f62898150326ab20c0a Mon Sep 17 00:00:00 2001 From: maxim-konovalov Date: Wed, 28 Feb 2024 18:27:45 +0300 Subject: [PATCH] add simple benchmark for strcrc32 hash --- vshard_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vshard_test.go b/vshard_test.go index c3b7edc..d75d094 100644 --- a/vshard_test.go +++ b/vshard_test.go @@ -56,3 +56,9 @@ func TestRouterBucketIDStrCRC32(t *testing.T) { require.Equal(t, uint64(103202), BucketIDStrCRC32("2707623829", uint64(256000))) require.Equal(t, uint64(35415), BucketIDStrCRC32("2706201716", uint64(256000))) } + +func BenchmarkRouterBucketIDStrCRC32(b *testing.B) { + for i := 0; i < b.N; i++ { + BucketIDStrCRC32("test_bench_key", uint64(256000)) + } +}