Bug 500728

Summary: Saving can get quite slow
Product: [Eclipse Project] JDT Reporter: Lukas Eder <lukas.eder>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: NEW --- QA Contact: Manoj N Palat <manoj.palat>
Severity: normal    
Priority: P3 CC: jarthana, sxenos
Version: 4.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows NT   
Whiteboard: stalebug

Description Lukas Eder CLA 2016-09-02 06:09:28 EDT
I've made the experience that Eclipse can get quite slow on the organise imports save action when saving some files. I've run a profiling session with JMC and this is the single hot method:

Stack Trace	Sample Count	Percentage(%)
org.eclipse.jdt.core.compiler.CharOperation.hashCode(char[])	477	35.624
   org.eclipse.jdt.internal.compiler.util.HashtableOfObject.putUnsafely(char[], Object)	477	35.624
      org.eclipse.jdt.internal.core.index.DiskIndex.mergeCategory(char[], DiskIndex, int[], FileOutputStream)	477	35.624
         org.eclipse.jdt.internal.core.index.DiskIndex.mergeCategories(DiskIndex, int[], FileOutputStream)	477	35.624
            org.eclipse.jdt.internal.core.index.DiskIndex.mergeWith(MemoryIndex)	477	35.624
               org.eclipse.jdt.internal.core.index.Index.save()	477	35.624
                  org.eclipse.jdt.internal.core.search.indexing.IndexManager.saveIndex(Index)	477	35.624
                     org.eclipse.jdt.internal.core.search.indexing.IndexManager.saveIndexes()	477	35.624
                        org.eclipse.jdt.internal.core.search.indexing.IndexManager.notifyIdle(long)	477	35.624
                           org.eclipse.jdt.internal.core.search.processing.JobManager.run()	477	35.624
                              java.lang.Thread.run()	477	35.624


This is the call tree leading to the hot method, and other related methods:

Stack Trace	Sample Count	Percentage(%)
java.lang.Thread.run()	819	61.165
   org.eclipse.jdt.internal.core.search.processing.JobManager.run()	814	60.792
      org.eclipse.jdt.internal.core.search.indexing.IndexManager.notifyIdle(long)	731	54.593
         org.eclipse.jdt.internal.core.search.indexing.IndexManager.saveIndexes()	731	54.593
            org.eclipse.jdt.internal.core.search.indexing.IndexManager.saveIndex(Index)	731	54.593
               org.eclipse.jdt.internal.core.index.Index.save()	731	54.593
                  org.eclipse.jdt.internal.core.index.DiskIndex.mergeWith(MemoryIndex)	731	54.593
                     org.eclipse.jdt.internal.core.index.DiskIndex.mergeCategories(DiskIndex, int[], FileOutputStream)	730	54.518
                        org.eclipse.jdt.internal.core.index.DiskIndex.mergeCategory(char[], DiskIndex, int[], FileOutputStream)	730	54.518
                           org.eclipse.jdt.internal.compiler.util.HashtableOfObject.putUnsafely(char[], Object)	593	44.287
                              org.eclipse.jdt.core.compiler.CharOperation.hashCode(char[])	477	35.624
                              org.eclipse.jdt.internal.compiler.util.HashtableOfObject.rehash()	48	3.585
                           org.eclipse.jdt.internal.core.index.DiskIndex.readCategoryTable(char[], boolean)	57	4.257
                           org.eclipse.jdt.internal.compiler.util.HashtableOfObject.get(char[])	53	3.958
                           org.eclipse.jdt.internal.core.index.DiskIndex$IntList.add(int)	24	1.792
                           org.eclipse.jdt.internal.core.index.DiskIndex.writeCategoryTable(char[], HashtableOfObject, FileOutputStream)	3	0.224


Most time is spent inside of DiskIndex.mergeCategory()

I'm very happy to provide additional information that might be needed to track down the problem. I didn't want to add too much information that won't help solve the issue.
Comment 1 Eclipse Genie CLA 2020-08-20 14:50:09 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 2 Eclipse Genie CLA 2022-12-16 15:31:36 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.