Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 202867 Details for
Bug 354332
DeltaProcessor exhibits O(N^2) behavior
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch with performance test
bug_354332.txt (text/plain), 6.65 KB, created by
Jay Arthanareeswaran
on 2011-09-07 04:44:11 EDT
(
hide
)
Description:
Patch with performance test
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2011-09-07 04:44:11 EDT
Size:
6.65 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/DeltaProcessor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java,v >retrieving revision 1.344 >diff -u -r1.344 DeltaProcessor.java >--- model/org/eclipse/jdt/internal/core/DeltaProcessor.java 27 Apr 2011 15:44:15 -0000 1.344 >+++ model/org/eclipse/jdt/internal/core/DeltaProcessor.java 7 Sep 2011 07:42:16 -0000 >@@ -953,6 +953,7 @@ > // project does not exist -> ignore > continue; > } >+ boolean hasChainedJar = false; > for (int j = 0; j < entries.length; j++){ > if (entries[j].getEntryKind() == IClasspathEntry.CPE_LIBRARY) { > IPath entryPath = entries[j].getPath(); >@@ -1022,7 +1023,7 @@ > System.out.println("- External JAR ADDED, affecting root: "+root.getElementName()); //$NON-NLS-1$ > } > elementAdded(root, null, null); >- javaProject.resetResolvedClasspath(); // in case it contains a chained jar >+ hasChainedJar |= !this.manager.isNonChainingJar(entryPath); > this.state.addClasspathValidation(javaProject); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=185733 > hasDelta = true; > } else if (status == EXTERNAL_JAR_CHANGED) { >@@ -1031,7 +1032,7 @@ > System.out.println("- External JAR CHANGED, affecting root: "+root.getElementName()); //$NON-NLS-1$ > } > contentChanged(root); >- javaProject.resetResolvedClasspath(); // in case it contains a chained jar >+ hasChainedJar |= !this.manager.isNonChainingJar(entryPath); > hasDelta = true; > } else if (status == EXTERNAL_JAR_REMOVED) { > PackageFragmentRoot root = (PackageFragmentRoot) javaProject.getPackageFragmentRoot(entryPath.toString()); >@@ -1039,13 +1040,17 @@ > System.out.println("- External JAR REMOVED, affecting root: "+root.getElementName()); //$NON-NLS-1$ > } > elementRemoved(root, null, null); >- javaProject.resetResolvedClasspath(); // in case it contains a chained jar >+ hasChainedJar |= !this.manager.isNonChainingJar(entryPath); > this.state.addClasspathValidation(javaProject); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=185733 > hasDelta = true; > } > } > } > } >+ >+ if (hasChainedJar) { >+ javaProject.resetResolvedClasspath(); >+ } > } > // ensure the external file cache is reset so that if a .jar file is deleted but no longer on the classpath, it won't appear as changed next time it is added > JavaModel.flushExternalFileCache(); >#P org.eclipse.jdt.core.tests.performance >Index: src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java,v >retrieving revision 1.51 >diff -u -r1.51 FullSourceWorkspaceModelTests.java >--- src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java 19 Apr 2011 05:25:06 -0000 1.51 >+++ src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java 7 Sep 2011 07:42:18 -0000 >@@ -97,7 +97,7 @@ > // "testPerfSearchAllTypeNamesAndReconcile", > // }; > >-// TESTS_PREFIX = "testPerfReconcile"; >+ TESTS_PREFIX = "testRefreshExternalArchives"; > } > public static Test suite() { > Test suite = buildSuite(testClass()); >@@ -347,7 +347,11 @@ > } > assertEquals(message, expected, actual); > } >- >+private void touchFiles(File[] files) { >+ for(int index=0; index < files.length; index++) { >+ files[index].setLastModified(System.currentTimeMillis()); >+ } >+} > /* > * Creates a simple Java project with no source folder and only rt.jar on its classpath. > */ >@@ -1371,6 +1375,57 @@ > System.out.println((System.currentTimeMillis()-startTime)+"ms"); > } > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=354332 >+public void testRefreshExternalArchives() throws Exception { >+ int jarCount = 500; >+ File[] files = new File[jarCount]; >+ IJavaModel model = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()); >+ try { >+ IClasspathEntry[] classpath = new IClasspathEntry[jarCount]; >+ for (int index = 0; index < jarCount; index++) { >+ String filePath = getExternalResourcePath("lib"+ index +".jar"); >+ org.eclipse.jdt.core.tests.util.Util.createJar(new String[0], >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n", >+ }, >+ filePath, >+ JavaCore.VERSION_1_4); >+ classpath[index] = JavaCore.newLibraryEntry(new Path(filePath), null, null); >+ files[index] = new File(filePath); >+ } >+ BIG_PROJECT.setRawClasspath(classpath, null); >+ >+ // warm up >+ int max = 20; >+ int warmup = WARMUP_COUNT / 10; >+ for (int i = 0; i < warmup; i++) { >+ for (int j = 0; j < max; j++) { >+ touchFiles(files); >+ model.refreshExternalArchives(new IJavaElement[] {BIG_PROJECT}, null); >+ } >+ } >+ >+ // measure performance >+ for (int i = 0; i < MEASURES_COUNT; i++) { >+ runGc(); >+ startMeasuring(); >+ for (int j = 0; j < max; j++) { >+ touchFiles(files); >+ model.refreshExternalArchives(new IJavaElement[] {BIG_PROJECT}, null); >+ } >+ stopMeasuring(); >+ } >+ >+ commitMeasurements(); >+ assertPerformance(); >+ >+ } finally { >+ for(int index=0; index < files.length; index++) { >+ files[index].delete(); >+ } >+ } >+} > > protected void resetCounters() { > // do nothing >Index: src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTests.java,v >retrieving revision 1.60 >diff -u -r1.60 FullSourceWorkspaceTests.java >--- src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTests.java 7 Jan 2011 20:45:08 -0000 1.60 >+++ src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTests.java 7 Sep 2011 07:42:18 -0000 >@@ -1246,4 +1246,20 @@ > // Return created options map > return optionsMap; > } >+ >+ protected String getExternalPath() { >+ String path = ""; >+ try { >+ path = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile().getParentFile().getCanonicalPath(); >+ if (path.charAt(path.length()-1) != File.separatorChar) >+ path += File.separatorChar; >+ } catch (IOException e) { >+ e.printStackTrace(); >+ } >+ return path; >+ } >+ >+ protected String getExternalResourcePath(String relativePath) { >+ return getExternalPath() + relativePath; >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 354332
:
201207
| 202867