Copilot commented on code in PR #3602:
URL: https://github.com/apache/dubbo-go/pull/3602#discussion_r3757369102


##########
metadata/report/zookeeper/report.go:
##########
@@ -144,17 +150,42 @@ func (m *zookeeperMetadataReport) 
ListAppRevisions(application string) ([]report
                }
                return nil, err
        }
+       revisions := make([]report.AppRevision, len(children))
+       found := make([]bool, len(children))
+       jobs := make(chan int, len(children))
+       for i := range children {
+               jobs <- i
+       }
+       close(jobs)
+
+       var workers sync.WaitGroup
+       workerCount := min(len(children), listAppRevisionsMaxConcurrency)
+       workers.Add(workerCount)
+       for range workerCount {

Review Comment:
   `jobs := make(chan int, len(children))` buffers one int per child, which 
adds avoidable O(n) memory overhead on top of the already O(n) slices. Since 
this code path is specifically about handling apps with many revisions, it’s 
better to bound the job queue as well (or stream jobs) so large revision counts 
don’t cause large channel allocations.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to