Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThirumala Reddy Mutchukota2013-06-25 18:23:14 +0000
committerJayaprakash Arthanareeswaran2013-08-22 04:36:32 +0000
commit773c88d3e635cbc1422720dad5721da00c844211 (patch)
treeba1d57949dfab1d87c82e1cc8b7116805f99c03d /org.eclipse.jdt.core.tests.performance
parentd41f9ab3858829dc35f4c402ccaa4dc24b08d8cb (diff)
downloadeclipse.jdt.core-773c88d3e635cbc1422720dad5721da00c844211.tar.gz
eclipse.jdt.core-773c88d3e635cbc1422720dad5721da00c844211.tar.xz
eclipse.jdt.core-773c88d3e635cbc1422720dad5721da00c844211.zip
Fixed bug 411423 : A major portion of time is spent on checking for
external folders while resolving a classpath Change-Id: I5d249d7ed3e9446663e4fd768efe563dc5b8270a Signed-off-by: Thirumala Reddy Mutchukota <thirumala@google.com>
Diffstat (limited to 'org.eclipse.jdt.core.tests.performance')
-rw-r--r--org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java67
1 files changed, 66 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java
index 57f046fe45..2cd10aa25c 100644
--- a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java
+++ b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Thirumala Reddy Mutchukota <thirumala@google.com> - Contribution to bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=411423
*******************************************************************************/
package org.eclipse.jdt.core.tests.performance;
@@ -1436,6 +1437,70 @@ public void testRefreshExternalArchives() throws Exception {
}
}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=411423
+public void testResolveClasspath() throws Exception {
+ int jarCount = 100;
+ File[] libraryFiles = new File[jarCount];
+ File[] srcAttachmentFiles = new File[jarCount];
+ IClasspathEntry[] oldClasspath = BIG_PROJECT.getRawClasspath();
+ try {
+ IClasspathEntry[] classpath = new IClasspathEntry[jarCount];
+ for (int index = 0; index < jarCount; index++) {
+ String libraryFilePath = 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",
+ },
+ libraryFilePath,
+ JavaCore.VERSION_1_4);
+ libraryFiles[index] = new File(libraryFilePath);
+
+ String srcAttachmentFilePath = getExternalResourcePath("lib" + index + "-src.jar");
+ org.eclipse.jdt.core.tests.util.Util.createJar(new String[0],
+ new String[] {
+ "META-INF/MANIFEST.MF",
+ "Manifest-Version: 1.0\n",
+ },
+ srcAttachmentFilePath,
+ JavaCore.VERSION_1_4);
+ srcAttachmentFiles[index] = new File(srcAttachmentFilePath);
+
+ classpath[index] = JavaCore.newLibraryEntry(new Path(libraryFilePath), new Path(srcAttachmentFilePath), null);
+ }
+ 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++) {
+ BIG_PROJECT.resolveClasspath(classpath);
+ }
+ }
+
+ // measure performance
+ for (int i = 0; i < MEASURES_COUNT; i++) {
+ runGc();
+ startMeasuring();
+ for (int j = 0; j < max; j++) {
+ BIG_PROJECT.resolveClasspath(classpath);
+ }
+ stopMeasuring();
+ }
+
+ commitMeasurements();
+ assertPerformance();
+
+ } finally {
+ BIG_PROJECT.setRawClasspath(oldClasspath, null);
+ for (int index = 0; index < libraryFiles.length; index++) {
+ libraryFiles[index].delete();
+ srcAttachmentFiles[index].delete();
+ }
+ }
+}
+
protected void resetCounters() {
// do nothing
}

Back to the top