OndroMih commented on code in PR #9324:
URL: https://github.com/apache/netbeans/pull/9324#discussion_r3044680667


##########
ide/git/src/org/netbeans/modules/git/FileStatusCache.java:
##########
@@ -579,8 +585,8 @@ private void refreshStatusesBatch (Map<File, GitStatus> 
interestingFiles) {
             }
             updateIndexBatch(indexUpdates);
         }
-        for (ChangedEvent event : events) {
-            fireFileStatusChanged(event);
+        if (!events.isEmpty()) {
+            listenerSupport.firePropertyChange(PROP_FILES_STATUS_CHANGED, 
null, events);

Review Comment:
   Actually, the overhead reduction is almost negligible. I was tempted to 
remove this but then I found out one more way to optimize this, by running the 
property change listeners asynchronously in background thread. 
   
   Each single file status update is an I/O operation and thus slow. Running 
the updates in background moves this off the main thread. Running everything in 
batch allows offloading everything to a single background thread instead of 
updating each file in separate thread, which might be slower because of 
synchronization between threads. 
   
   Therefore I kept the property change event for all of the files and changed 
the 2 listeners to run in background, updating all the files with a single 
background thread.



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

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to