mbien commented on code in PR #4324:
URL: https://github.com/apache/netbeans/pull/4324#discussion_r914487947
##########
ide/parsing.indexing/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater.java:
##########
@@ -3250,7 +3250,23 @@ public void run(ResultIterator resultIterator) throws
Exception {
}
}
}
- ParserManager.parse(sources.keySet(), new T());
+
+ // Performance of ParserManager#parse suffers if the
sources
+ // are of mixed mimetype. ParserManager will then generate
+ // snapshots with mixed mimetypes, which violates the
+ // ParserFactory contract and leads to slower code paths.
+ //
+ // To work around this the sources are passed to the
+ // ParserManager grouped by their mimetype
+
+ Map<String,List<Source>> sourcesByMimeType = sources
+ .keySet()
+ .stream()
+
.collect(Collectors.groupingBy(s->s.getMimeType()));
+
+ for(List<Source> l: sourcesByMimeType.values()) {
+ ParserManager.parse(l, new T());
+ }
Review Comment:
I am wondering if it would make sense to sort that map in some way, e.g to
try to index the primary language first to get a updated IDE state as fast as
possible.
The primary language is probably the one with the largest list in that map?
It might make no practical difference since the other lists might be small in
comparison.
There is probably also an argument to be made for indexing the smallest list
first to get incremental results fast.
--
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