Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerome Lanneluc2007-09-21 13:16:47 +0000
committerJerome Lanneluc2007-09-21 13:16:47 +0000
commit821b6028ffbd0ba8edfd1a0534c32e817f4e830d (patch)
treeeb1c711625657f49f5145b15714003c572660a08 /org.eclipse.jdt.core.tests.performance
parented25425f5de4194a0f32ce4c1315af886ca42c42 (diff)
downloadeclipse.jdt.core-821b6028ffbd0ba8edfd1a0534c32e817f4e830d.tar.gz
eclipse.jdt.core-821b6028ffbd0ba8edfd1a0534c32e817f4e830d.tar.xz
eclipse.jdt.core-821b6028ffbd0ba8edfd1a0534c32e817f4e830d.zip
HEAD - 190094
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.java84
-rw-r--r--org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTests.java2
2 files changed, 86 insertions, 0 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 30513662f2..6a796a970e 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
@@ -21,6 +21,7 @@ import junit.framework.*;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -83,6 +84,7 @@ private static Class testClass() {
protected void setUp() throws Exception {
super.setUp();
setUpBigProject();
+ setUpBigJars();
}
private void setUpBigProject() throws CoreException, IOException {
try {
@@ -171,6 +173,36 @@ private void setUpBigProject() throws CoreException, IOException {
}
}
+private void setUpBigJars() throws Exception {
+ String bigProjectLocation = BIG_PROJECT.getResource().getLocation().toOSString();
+ int size = PACKAGES_COUNT * 10;
+ File bigJar1 = new File(bigProjectLocation, BIG_JAR1_NAME);
+ if (!bigJar1.exists()) {
+ String[] pathAndContents = new String[size * 2];
+ for (int i = 0; i < size; i++) {
+ pathAndContents[i*2] = "/p" + i + "/X" + i + ".java";
+ pathAndContents[i*2 + 1] =
+ "package p" + i + ";\n" +
+ "public class X" + i + "{\n" +
+ "}";
+ }
+ org.eclipse.jdt.core.tests.util.Util.createJar(pathAndContents, bigJar1.getPath(), "1.3");
+ BIG_PROJECT.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
+ }
+ File bigJar2 = new File(bigProjectLocation, BIG_JAR2_NAME);
+ if (!bigJar2.exists()) {
+ String[] pathAndContents = new String[size * 2];
+ for (int i = 0; i < size; i++) {
+ pathAndContents[i*2] = "/q" + i + "/Y" + i + ".java";
+ pathAndContents[i*2 + 1] =
+ "package q" + i + ";\n" +
+ "public class Y" + i + "{\n" +
+ "}";
+ }
+ org.eclipse.jdt.core.tests.util.Util.createJar(pathAndContents, bigJar2.getPath(), "1.3");
+ BIG_PROJECT.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
+ }
+}
/* (non-Javadoc)
* @see junit.framework.TestCase#tearDown()
*/
@@ -742,6 +774,58 @@ public void testPerfSearchAllTypeNamesAndReconcile() throws CoreException {
}
/*
+ * Performance test for the opening of class files in 2 big jars (that each would fill the Java model cache if all pkgs were opened).
+ * (see bug 190094 Java Outline Causes Eclipse Lock-up.)
+ */
+public void testPopulateTwoBigJars() throws CoreException {
+
+ IJavaProject project = null;
+ try {
+ project = createJavaProject("HugeJarProject");
+ IFile bigJar1 = BIG_PROJECT.getProject().getFile(BIG_JAR1_NAME);
+ IFile bigJar2 = BIG_PROJECT.getProject().getFile(BIG_JAR2_NAME);
+ project.setRawClasspath(
+ new IClasspathEntry[] {
+ JavaCore.newLibraryEntry(bigJar1.getFullPath(), null, null),
+ JavaCore.newLibraryEntry(bigJar2.getFullPath(), null, null),
+ }, null);
+ AbstractJavaModelTests.waitUntilIndexesReady();
+ AbstractJavaModelTests.waitForAutoBuild();
+ IPackageFragmentRoot root1 = project.getPackageFragmentRoot(bigJar1);
+ IPackageFragmentRoot root2 = project.getPackageFragmentRoot(bigJar2);
+
+ // warm up
+ int max = 20;
+ int warmup = WARMUP_COUNT / 10;
+ for (int i = 0; i < warmup; i++) {
+ project.close();
+ for (int j = 0; j < max; j++) {
+ root1.getPackageFragment("p" + j).open(null);
+ root2.getPackageFragment("q" + j).open(null);
+ }
+ }
+
+ // measure performance
+ for (int i = 0; i < MEASURES_COUNT; i++) {
+ project.close();
+ runGc();
+ startMeasuring();
+ for (int j = 0; j < max; j++) {
+ root1.getPackageFragment("p" + j).open(null);
+ root2.getPackageFragment("q" + j).open(null);
+ }
+ stopMeasuring();
+ }
+
+ commitMeasurements();
+ assertPerformance();
+ } finally {
+ if (project != null)
+ project.getProject().delete(false, null);
+ }
+}
+
+/*
* Performance test for looking up package fragments
* (see bug 72683 Slow code assist in Display view)
*/
diff --git a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTests.java b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTests.java
index 423df9ed92..2feaf18db3 100644
--- a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTests.java
+++ b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTests.java
@@ -99,6 +99,8 @@ public abstract class FullSourceWorkspaceTests extends TestCase {
protected static ICompilationUnit PARSER_WORKING_COPY;
protected final static String BIG_PROJECT_NAME = "BigProject";
protected static JavaProject BIG_PROJECT;
+ protected static final String BIG_JAR1_NAME = "big1.jar";
+ protected static final String BIG_JAR2_NAME = "big2.jar";
// protected final static String JUNIT_PROJECT_NAME = "junit";
// protected static IJavaProject JUNIT_PROJECT;

Back to the top