drpmma opened a new issue, #7189: URL: https://github.com/apache/rocketmq/issues/7189
### Before Creating the Enhancement Request - [X] I have confirmed that this should be classified as an enhancement rather than a bug/feature. ### Summary The current implementation of the updateSubscription method in the code has a potential issue with the time complexity of the loop. The loop iterates over the subscription table to check if a topic exists in the subscription list. This results in a time complexity of O(n) for each iteration. ### Motivation Optimize performance for a large scale of subscriptions. ### Describe the Solution You'd Like To optimize the time complexity, we can introduce an additional HashSet to store the new topics. By doing so, we can perform a constant time (O(1)) lookup instead of iterating over the subscription table in the loop. This will significantly reduce the time complexity of the loop. ### Describe Alternatives You've Considered No ### Additional Context _No response_ -- 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]
