From 3ce30e36bb34cb1c84c0f116fa42bc40c25771cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Wed, 17 Apr 2024 17:18:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/ttlcache/utils_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/ttlcache/utils_test.go b/internal/ttlcache/utils_test.go index 5f9c88f..7d395e9 100644 --- a/internal/ttlcache/utils_test.go +++ b/internal/ttlcache/utils_test.go @@ -1,6 +1,7 @@ package ttlcache import ( + "github.com/cespare/xxhash/v2" "runtime" "testing" ) @@ -11,3 +12,10 @@ func BenchmarkHashKey(b *testing.B) { HashKey([]byte("HELLO,WORLDHELLO,WORLDHELLO,WORLDHELLO,WORLDHELLO,WORLDHELLO,WORLD")) } } + +func BenchmarkHashKey2(b *testing.B) { + runtime.GOMAXPROCS(1) + for i := 0; i < b.N; i++ { + xxhash.Sum64String("HELLO,WORLDHELLO,WORLDHELLO,WORLDHELLO,WORLDHELLO,WORLDHELLO,WORLD") + } +}