Alanxtl opened a new issue, #3407: URL: https://github.com/apache/dubbo-go/issues/3407
## Background Some load balance implementations allocate temporary slices on each `Select` call. For common small invoker lists, those allocations can be avoided without changing the selection algorithm. Examples include weighted random, least-active selection, and alias-method picker construction. ## Scope Reduce temporary allocations in request-time load balance selection while keeping the existing selection semantics unchanged. A conservative approach is to use fixed-size stack arrays for small invoker counts and fall back to heap slices for larger lists. Relevant code: - `cluster/loadbalance/random/loadbalance.go` - `cluster/loadbalance/leastactive/loadbalance.go` - `cluster/loadbalance/aliasmethod/alias_method.go` ## Acceptance Criteria - Load balance behavior and existing tests remain unchanged. - Benchmarks show reduced allocations for representative small and medium invoker counts. - Avoid introducing long-lived caches in this issue; keep the change local and low-risk. - `go test ./cluster/loadbalance` passes. -- 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]
