Copilot commented on code in PR #928:
URL: https://github.com/apache/dubbo-go-pixiu/pull/928#discussion_r3294006801
##########
pkg/cluster/loadbalancer/maglev/permutation.go:
##########
@@ -187,10 +186,7 @@ func (t *LookUpTable) removePerm(dst int) {
// Hash the input key.
func (t *LookUpTable) Hash(key string) uint32 {
- var h maphash.Hash
- h.SetSeed(maphash.MakeSeed())
- h.WriteString(key)
- return uint32(h.Sum64())
+ return _hash1(key)
}
Review Comment:
`Hash()` is called on the request path via `LookUpTable.Get()`. Switching it
from `maphash` to `_hash1` (SHA3-512 over `[]byte(key)`) makes each lookup
significantly more CPU/alloc heavy than before. Consider using a faster
deterministic hash for request keys (e.g., BLAKE2b-256 / SHA3-256, or a
non-crypto hash), or document/benchmark the expected performance impact to
ensure Maglev remains viable under high QPS.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]