mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-07 02:20:25 +08:00
22 lines
453 B
Go
22 lines
453 B
Go
package ttlcache
|
|
|
|
import (
|
|
"github.com/cespare/xxhash/v2"
|
|
"runtime"
|
|
"testing"
|
|
)
|
|
|
|
func BenchmarkHashKey(b *testing.B) {
|
|
runtime.GOMAXPROCS(1)
|
|
for i := 0; i < b.N; i++ {
|
|
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")
|
|
}
|
|
}
|