dubbo-go icon indicating copy to clipboard operation
dubbo-go copied to clipboard

perf: optimize IsEquals and ToMap to reduce allocations

Open JunLa-0 opened this issue 5 months ago • 6 comments

Optimize URL equality comparison and map conversion to avoid unnecessary allocations. IsEquals() now compares fields directly instead of materializing two full maps via ToMap(). ToMap() pre-sizes the map and uses a single-pass split for Location parsing.

Fixes: #3394

Signed-off-by: [email protected]

JunLa-0 avatar Jun 12 '26 03:06 JunLa-0

Codecov Report

:x: Patch coverage is 77.41935% with 14 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 52.42%. Comparing base (e6e14fd) to head (6a5d4c4). :warning: Report is 60 commits behind head on develop.

Files with missing lines Patch % Lines
common/url.go 77.41% 8 Missing and 6 partials :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3402      +/-   ##
===========================================
+ Coverage    52.40%   52.42%   +0.01%     
===========================================
  Files          492      492              
  Lines        37785    37826      +41     
===========================================
+ Hits         19800    19829      +29     
- Misses       16380    16387       +7     
- Partials      1605     1610       +5     

:umbrella: View full report in Codecov by Harness.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Jun 12 '26 03:06 codecov-commenter

the target branch should be develop

Alanxtl avatar Jun 12 '26 03:06 Alanxtl

@ywxzm03 help review this :)

Alanxtl avatar Jun 12 '26 03:06 Alanxtl

update to latest develop and run https://github.com/apache/dubbo-go/blob/develop/common/url_benchmark_test.go to see the performance shift before and after you commit, and paste the result comparison here

可以参考 https://github.com/apache/dubbo-go/pull/3403 的pr body写法

Alanxtl avatar Jun 12 '26 03:06 Alanxtl

@JunLa-0 any progess?

Alanxtl avatar Jun 24 '26 02:06 Alanxtl

@JunLa-0 any progess? If no further update, this pr will be closed and we will assign others to work on this.

Alanxtl avatar Jul 07 '26 12:07 Alanxtl

close via #3488

Alanxtl avatar Jul 13 '26 09:07 Alanxtl