diff options
author | Jerome Lanneluc | 2008-06-26 10:34:34 +0000 |
---|---|---|
committer | Jerome Lanneluc | 2008-06-26 10:34:34 +0000 |
commit | fb3a08eec3c3ef8e80508685d28be0e6a5d41be7 (patch) | |
tree | aed1b2b4e5fcf91642561bc2f6006bdf8a53fb1a /org.eclipse.jdt.core.tests.performance | |
parent | 8d96b52b3ee6d748bf52fa2774ac5cb71b98586d (diff) | |
download | eclipse.jdt.core-fb3a08eec3c3ef8e80508685d28be0e6a5d41be7.tar.gz eclipse.jdt.core-fb3a08eec3c3ef8e80508685d28be0e6a5d41be7.tar.xz eclipse.jdt.core-fb3a08eec3c3ef8e80508685d28be0e6a5d41be7.zip |
HEAD - 135906
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.java | 50 |
1 files changed, 50 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 4113a7cdcd..a38e70a666 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 @@ -760,6 +760,56 @@ public void testPerfReconcileBigFileWithSyntaxError() throws JavaModelException } } +/* + * Ensures that the performance of reconcile on a CU with lots of duplicates is acceptable. + * (regression test for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=135906 ) + */ +public void testReconcileDuplicates() throws JavaModelException { + tagAsSummary("Reconcile editor change on file with lots of duplicates", false); // do NOT put in fingerprint + + // build big file contents + StringBuffer contents = new StringBuffer(); + contents.append("public class CUWithDuplicates {\n"); + int fooIndex = 0; + while (fooIndex < 2000) { // add 2000 duplicate methods + contents.append(" void foo() {}\n"); + contents.append(fooIndex++); + } + contents.append("} //"); // ensure it ends with a line comment that is edited below + + ICompilationUnit workingCopy = null; + try { + // Setup + workingCopy = (ICompilationUnit) JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/BigProject/src/CUWithDuplicates.java"))); + workingCopy.becomeWorkingCopy(null); + + // Warm up + int warmup = WARMUP_COUNT / 10; + for (int i=0; i<warmup; i++) { + workingCopy.getBuffer().setContents(contents.append('a').toString()); + workingCopy.reconcile(AST.JLS3, false/*no pb detection*/, null/*no owner*/, null/*no progress*/); + } + + // Measures + resetCounters(); + for (int i=0; i<MEASURES_COUNT; i++) { + workingCopy.getBuffer().setContents(contents.append('a').toString()); + runGc(); + startMeasuring(); + workingCopy.reconcile(AST.JLS3, false/*no pb detection*/, null/*no owner*/, null/*no progress*/); + stopMeasuring(); + } + + // Commit + commitMeasurements(); + assertPerformance(); + + } finally { + if (workingCopy != null) + workingCopy.discardWorkingCopy(); + } +} + /** * Ensures that the reconciler does nothing when the source * to reconcile with is the same as the current contents. |