diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerTest.java index ef73b2fde6a..9d3747d8d54 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerTest.java @@ -24,7 +24,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Hashtable; @@ -151,159 +150,6 @@ private void addResourceChangeListener(MarkersChangeListener listener) { } } - public void _testPerformanceManyResources() { - debug("testPerformanceManyResources"); - long start; - long stop; - - // cleanup old resources and create our own - IResource[] testResources = null; - try { - getWorkspace().getRoot().delete(false, getMonitor()); - testResources = createLargeHierarchy(); - } catch (CoreException e) { - fail("0.0", e); - } - - // header info - final int markersPerResource = 20; - final int numMarkers = testResources.length * markersPerResource; - display("\nNumber of resources: " + testResources.length); - display("Markers per resource: " + markersPerResource); - display("Total Number of Markers: " + numMarkers); - - // Create an array with a bunch of markers. - IWorkspaceRunnable body = monitor -> { - IResourceVisitor visitor = resource -> { - for (int i = 0; i < markersPerResource; i++) { - resource.createMarker(IMarker.PROBLEM); - } - return true; - }; - getWorkspace().getRoot().accept(visitor); - }; - try { - start = System.currentTimeMillis(); - getWorkspace().run(body, getMonitor()); - stop = System.currentTimeMillis(); - display("Task: creating markers"); - display(start, stop); - } catch (CoreException e) { - fail("0.0", e); - } - - // gather the markers for use. don't time this one. - final IMarker[] markers = new IMarker[numMarkers]; - try { - IMarker[] temp = getWorkspace().getRoot().findMarkers(null, true, IResource.DEPTH_INFINITE); - assertEquals("0.1", numMarkers, temp.length); - System.arraycopy(temp, 0, markers, 0, temp.length); - } catch (CoreException e) { - fail("0.2", e); - } - - // create attributes on each marker - body = monitor -> { - for (IMarker marker : markers) { - marker.setAttribute(IMarker.MESSAGE, getRandomString()); - } - }; - try { - start = System.currentTimeMillis(); - getWorkspace().run(body, getMonitor()); - stop = System.currentTimeMillis(); - display("Task: setting an attribute on each marker"); - display(start, stop); - } catch (CoreException e) { - fail("1.0", e); - } - - // get the attribute from each marker - body = monitor -> { - for (IMarker marker : markers) { - marker.getAttribute(IMarker.MESSAGE); - } - }; - try { - start = System.currentTimeMillis(); - getWorkspace().run(body, getMonitor()); - stop = System.currentTimeMillis(); - display("Task: getting an attribute on each marker"); - display(start, stop); - } catch (CoreException e) { - fail("2.0", e); - } - } - - public void _testPerformanceOneResource() { - debug("testPerformanceOneResource"); - long start; - long stop; - final int numMarkers = 4000; - - // header info - display("Number of resources: 1"); - display("Number of Markers: " + numMarkers); - - // Create an array with a bunch of markers. - final IMarker markers[] = new IMarker[numMarkers]; - IWorkspaceRunnable body = monitor -> { - IResource resource = getWorkspace().getRoot(); - for (int i = 0; i < markers.length; i++) { - markers[i] = resource.createMarker(IMarker.PROBLEM); - } - }; - try { - start = System.currentTimeMillis(); - getWorkspace().run(body, getMonitor()); - stop = System.currentTimeMillis(); - display("Task: creating markers"); - display(start, stop); - } catch (CoreException e) { - fail("0.0", e); - } - - // create attributes on each marker - body = monitor -> { - for (IMarker marker : markers) { - marker.setAttribute(IMarker.MESSAGE, getRandomString()); - } - }; - try { - start = System.currentTimeMillis(); - getWorkspace().run(body, getMonitor()); - stop = System.currentTimeMillis(); - display("Task: setting an attribute on each marker"); - display(start, stop); - } catch (CoreException e) { - fail("1.0", e); - } - - java.util.Comparator c = (o1, o2) -> { - try { - String name1 = (String) o1.getAttribute(IMarker.MESSAGE); - String name2 = (String) o2.getAttribute(IMarker.MESSAGE); - if (name1 == null) { - name1 = ""; - } - if (name2 == null) { - name2 = ""; - } - int result = name1.compareToIgnoreCase(name2); - return result; - } catch (CoreException e) { - fail("2.0", e); - } - // avoid compiler error - return -1; - }; - start = System.currentTimeMillis(); - Arrays.sort(markers, c); - stop = System.currentTimeMillis(); - display("Task: sort arrays based on MESSAGE attribute"); - display(start, stop); - } - protected void addChildren(ArrayList result, IPath root, int breadth, int depth) { for (int i = 1; i < breadth + 1; i++) { IPath child = root.append(i + "");