dubbo-go
dubbo-go copied to clipboard
perf(common): reduce URL CloneWithFilter and MergeURL params copying
Background
URL.CloneWithFilter() and URL.MergeURL() are used in registry, directory, configurator, and invoker update flows. These methods currently perform multiple map copies and repeated locking through public helper methods. That is safe, but it is expensive on hot update paths.
Related to #3248.
Scope
Reduce copying and locking in clone/merge paths:
- Keep public
GetParams()/CopyParams()safety semantics unchanged. - Introduce internal helpers for copying or merging
url.Valuesunder a single lock where possible. - Avoid calling
SetParamonce per key inCloneWithFilter()when the new URL is still local and not shared. - Avoid extra
GetParams()copies inMergeURL()when the code only needs to build the merged params map. - Preserve multi-value parameter semantics when cloning and merging.
Acceptance criteria
- Existing behavior is preserved for clone, filtered clone, and merge.
- Add tests for multi-value params through
CloneWithFilter()andMergeURL()if missing. - Add or update benchmarks showing allocation reduction for clone and merge cases with
-benchmem. go test ./commonpasses.
please assign to me
please assign to me
SURE
Kindly ask if there somebody to working for this issue ? If not, I am glad to undertake it!
close via #3403