matthiasblaesing commented on PR #3976:
URL: https://github.com/apache/netbeans/pull/3976#issuecomment-1097204929

   I was annoyed by the performance of scanning of JS sources and I had the 
feeling, that the performance dropped after the changes from 
https://github.com/apache/netbeans/pull/3516. While I'm still not sure whether 
performance suffered, I noticed a strange thing in the profile (npss in the 
file):
   
   [baseline.zip](https://github.com/apache/netbeans/files/8476421/baseline.zip)
   
   
![image](https://user-images.githubusercontent.com/2179736/163050644-aaa90c81-fd23-4102-a8dd-0a9552ae8c24.png)
   
   A significant potion of the total time is spend in `MimePath#get`. As this 
was one of the big contributors, I had a look there and `MimePath` has a cache 
for resolved String -> MimePath mappings and the idea is: If we know the 
mapping from string to MimePath, we also know, that the string is a valid 
mimepath, so I added a fast path for the validation.
   
   A totally unscientific test looks promising:
   
   Baseline
   
   ```
    4.7.2log4j:WARN No appenders could be found for logger 
(nu.validator.source.LocationRecorder).
        [exec] log4j:WARN Please initialize the log4j system properly.
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: 
/home/matthias/tu/edu-udo-itmc-dev-presencetracking took: 413.883 ms (New or 
modified files: 41.000, Deleted files: 0) [Adding listeners took: 4 ms]
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete 
indexing of 1 source roots took: 413.883 ms (New or modified files: 41.000, 
Deleted files: 0) [Adding listeners took: 4 ms]
        [exec] INFO [org.netbeans.ui.indexing]: Indexing finished, indexing 
took 414.351 ms.
        [exec] INFO [org.netbeans.ui.indexing]: Indexing started, time from 
last indexing 0 ms.
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Resolving 
dependencies took: 15 ms
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete 
indexing of 0 binary roots took: 0 ms
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: 
/home/matthias/src/netbeans/nbbuild/netbeans/webcommon/jsstubs/reststubs.zip 
took: 161 ms (New or modified files: 14, Deleted files: 0) [Adding listeners 
took: 0 ms]
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: 
/home/matthias/src/netbeans/nbbuild/netbeans/webcommon/jsstubs/corestubs.zip 
took: 274 ms (New or modified files: 54, Deleted files: 0) [Adding listeners 
took: 0 ms]
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: 
/home/matthias/src/netbeans/nbbuild/netbeans/webcommon/jsstubs/domstubs.zip 
took: 469 ms (New or modified files: 133, Deleted files: 0) [Adding listeners 
took: 0 ms]
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete 
indexing of 3 source roots took: 904 ms (New or modified files: 201, Deleted 
files: 0) [Adding listeners took: 0 ms]
        [exec] INFO [org.netbeans.ui.indexing]: Indexing finished, indexing 
took 919 ms.
   ```
   
   Patched:
   
   ```
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: 
/home/matthias/tu/edu-udo-itmc-dev-presencetracking took: 342.169 ms (New or 
modified files: 41.000, Deleted files: 0) [Adding listeners took: 3 ms]
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete 
indexing of 1 source roots took: 342.169 ms (New or modified files: 41.000, 
Deleted files: 0) [Adding listeners took: 3 ms]
        [exec] INFO [org.netbeans.ui.indexing]: Indexing finished, indexing 
took 342.572 ms.
        [exec] INFO [org.netbeans.ui.indexing]: Indexing started, time from 
last indexing 0 ms.
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Resolving 
dependencies took: 14 ms
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete 
indexing of 0 binary roots took: 0 ms
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: 
/home/matthias/src/netbeans/nbbuild/netbeans/webcommon/jsstubs/reststubs.zip 
took: 168 ms (New or modified files: 14, Deleted files: 0) [Adding listeners 
took: 0 ms]
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: 
/home/matthias/src/netbeans/nbbuild/netbeans/webcommon/jsstubs/corestubs.zip 
took: 276 ms (New or modified files: 54, Deleted files: 0) [Adding listeners 
took: 0 ms]
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: 
/home/matthias/src/netbeans/nbbuild/netbeans/webcommon/jsstubs/domstubs.zip 
took: 445 ms (New or modified files: 133, Deleted files: 0) [Adding listeners 
took: 0 ms]
        [exec] INFO 
[org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete 
indexing of 3 source roots took: 889 ms (New or modified files: 201, Deleted 
files: 0) [Adding listeners took: 0 ms]
        [exec] INFO [org.netbeans.ui.indexing]: Indexing finished, indexing 
took 903 ms.
   ```
   
   There could be pathological cases (the ones where `tosString` called on a 
`CharSequence` is the bottleneck, but I expect the string case the common case.
   
   @dbalek what do you think?


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