Aias00 commented on code in PR #7270:
URL: https://github.com/apache/shenyu/pull/7270#discussion_r4110064972


##########
shenyu-registry/shenyu-registry-nacos/src/main/java/org/apache/shenyu/registry/nacos/NacosInstanceRegisterRepository.java:
##########
@@ -202,6 +200,15 @@ private void compareInstances(final Set<Instance> 
previousInstances, final Set<I
         }
     }
 
+    private boolean isSameInstance(final Instance current, final Instance 
previous) {

Review Comment:
   Non-blocking: correct helper, but note the cost change. The previous filter 
used `previousInstances.contains(item)` (a hash lookup); this streams the other 
set for every candidate, so `compareInstances` is now roughly 3*N*N comparisons 
per Nacos notification instead of O(N). Fine for small instance sets, which is 
the usual case, but you can restore the original cost by building one 
`Map<String, Instance>` keyed by the same identity (instanceId, else ip + ":" + 
port + ":" + clusterName) at the top of `compareInstances` and using 
`containsKey`.



-- 
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]

Reply via email to