Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize code in dubbo-common #5597

Merged
merged 1 commit into from
Mar 14, 2021
Merged

Optimize code in dubbo-common #5597

merged 1 commit into from
Mar 14, 2021

Conversation

OLPMO
Copy link
Contributor

@OLPMO OLPMO commented Jan 7, 2020

in java8,new Method[0] is better than new Method[methods.size()],you can learn about this from the below url:
https://shipilev.net/blog/2016/arrays-wisdom-ancients/

@OLPMO
Copy link
Contributor Author

OLPMO commented Jan 8, 2020

I have watched the log of ci,but I did not know how to fix this error.If anyone could tell me what should I do ,I would be very grateful.

@EZKAYOTWJPRKXWCUYEEB
Copy link
Contributor

I have watched the log of ci,but I did not know how to fix this error.If anyone could tell me what should I do ,I would be very grateful.

Fortunately, he performed correctly in my computer, or you can manually close the pr, reopen the pr, or submit a merge request to reactivate the ci check and try.

@codecov-io
Copy link

Codecov Report

Merging #5597 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #5597      +/-   ##
============================================
+ Coverage     61.21%   61.24%   +0.02%     
  Complexity      423      423              
============================================
  Files           922      922              
  Lines         37498    37489       -9     
  Branches       5431     5427       -4     
============================================
+ Hits          22956    22961       +5     
+ Misses        12056    12051       -5     
+ Partials       2486     2477       -9
Impacted Files Coverage Δ Complexity Δ
.../dubbo/common/threadlocal/InternalThreadLocal.java 73.52% <100%> (ø) 0 <0> (ø) ⬇️
...org/apache/dubbo/common/utils/CollectionUtils.java 89.09% <100%> (ø) 0 <0> (ø) ⬇️
...n/java/org/apache/dubbo/common/utils/UrlUtils.java 74.14% <100%> (+0.22%) 0 <0> (ø) ⬇️
...pache/dubbo/remoting/transport/AbstractServer.java 53.75% <0%> (-3.75%) 0% <0%> (ø)
...c/main/java/org/apache/dubbo/rpc/RpcException.java 80% <0%> (-3.34%) 0% <0%> (ø)
...g/apache/dubbo/registry/consul/ConsulRegistry.java 61.87% <0%> (-0.63%) 29% <0%> (ø)
...protobuf/support/GenericProtobufSerialization.java 60% <0%> (ø) 0% <0%> (ø) ⬇️
...n/serialize/kryo/optimized/KryoSerialization2.java 0% <0%> (ø) 0% <0%> (ø) ⬇️
...rg/apache/dubbo/common/timer/HashedWheelTimer.java 63.44% <0%> (+0.34%) 0% <0%> (ø) ⬇️
.../rpc/cluster/configurator/parser/ConfigParser.java 88.23% <0%> (+0.98%) 0% <0%> (ø) ⬇️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3308a19...f4159b3. Read the comment docs.

@lndj
Copy link

lndj commented Jan 14, 2020

in java8,new Method[0] is better than new Method[methods.size()],you can learn about this from the below url:
https://shipilev.net/blog/2016/arrays-wisdom-ancients/

I have read this article, are you sure new Method[0] is better than new Method[methods.size()]? Maybe you should read it again.

@OLPMO
Copy link
Contributor Author

OLPMO commented Jan 14, 2020

You can read the following sentences in the conclusion part. @lndj
Bottom line: toArray(new T[0]) seems faster, safer, and contractually cleaner, and therefore should be the default choice now. Future VM optimizations may close this performance gap for toArray(new T[size]), rendering the current "believed to be optimal" usages on par with an actually optimal one. Further improvements in toArray APIs would follow the same logic as toArray(new T[0]) — the collection itself should create the appropriate storage.

@AlbumenJ AlbumenJ merged commit ef03752 into apache:master Mar 14, 2021
AlbumenJ added a commit to AlbumenJ/dubbo that referenced this pull request May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants