This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Profiling snapshots show that method: FileObjectFactory.getCachedOnly(File, boolean) is a top hot spot (CND project, initial indexing/parsing of LLVM 3.3). Please: - reduce critical section by moving calculation of id out of synchronized block. - remove double synchronization of allIBaseFileObjects (remove Collections.synchronizedMap()) This two improvements reduce method wall time 41 -> 26 seconds (by YourKit profiler).
Created attachment 140198 [details] proposed patch
Also profiling snapshots show that allIBaseFileObjects is a top critical monitor. To resolve this bottleneck consider: - split lock on read/write lock. - split monolithic map on slices (see example in org.netbeans.modules.cnd.repository.disk.MemoryCache).
> This two improvements reduce method wall time 41 -> 26 seconds Thank you very much for the patch. Applied as http://hg.netbeans.org/core-main/rev/5c4d5bd4b630. > [...] allIBaseFileObjects is a top critical monitor. > To resolve this bottleneck consider: > - split lock on read/write lock. I would prefer this solution. > - split monolithic map on slices (see example in [...] MemoryCache).
Created attachment 140218 [details] Patch - Split lock on read/write lock Prepared patch that uses a ReadWrite lock instead of synchronization on allIBaseFileObjects object. Can you please check it? It would be great if you also could measure it to see how the performance was affected. Thanks.
(In reply to Jaroslav Havlin from comment #4) > Can you please check it? > It would be great if you also could measure it to see how the performance > was affected. > Thanks. Ok, I'll check.
(In reply to Alexander Simon from comment #5) > (In reply to Jaroslav Havlin from comment #4) > > Can you please check it? > > It would be great if you also could measure it to see how the performance > > was affected. > > Thanks. > Ok, I'll check. By YourKit profiler wall time of FileObjectFactory.getCachedOnly(File, boolean) is 3 seconds with patch.
(In reply to Alexander Simon from comment #6) > By YourKit profiler wall time of FileObjectFactory.getCachedOnly(File, > boolean) is 3 seconds with patch. Thank you very much. I've applied the patch: http://hg.netbeans.org/core-main/rev/8cfd3c4c0fed
we need this for studio
The change caused bug 236264. Method FileObjectFactory.collectForRefresh needs to get parents of FileObjects sometimes. If the parent has been garbage-collected during invocation of the method, a new object needs to be created for the parent, and thus write-lock needs to be acquired inside read-lock (which leads to a deadlock). Fixed in http://hg.netbeans.org/core-main/rev/61037d5ae9d7.
Integrated into 'main-silver', will be available in build *201309240002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/61037d5ae9d7 User: Jaroslav Havlin <jhavlin@netbeans.org> Log: #236094: Fix deadlock in FileObjectFactory - write-lock requested while a read-lock is held
(In reply to Vladimir Voskresensky from comment #8) > we need this for studio Vladimir, Alexander, can you please verify the fix, to ensure it can be included in 74patch1? Thank you.
(In reply to Jaroslav Havlin from comment #11) > (In reply to Vladimir Voskresensky from comment #8) > > we need this for studio > Vladimir, Alexander, can you please verify the fix, to ensure > it can be included in 74patch1? Thank you. Ok, I'll verify.
Now the profiler shows 5 sec in FileObjectFactory.getCachedOnly(File, boolean)
Thank you for verifying. Integrated into release74 branch: http://hg.netbeans.org/releases/rev/dacf17bb1399 (graft - patch) http://hg.netbeans.org/releases/rev/99a7f3f43b8a (graft - read/write lock) http://hg.netbeans.org/releases/rev/f061a7ebf9a2 (graft - fixed deadlock) http://hg.netbeans.org/releases/rev/880d5d21a994 (specification version)
Integrated into 'releases/release74', will be available in build *201311141216* or newer. Wait for official and publicly available build. Changeset: http://hg.netbeans.org/releases/rev/dacf17bb1399 User: Jaroslav Havlin <jhavlin@netbeans.org> Log: #236094: Improve performance of FileObjectFactory Patch by Alexander Simon.
masterfs module got updated, functionality verification would be appriciated by CND team.