mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
VFP test take 2: make Disposer disposing faster
This commit is contained in:
+2
-2
@@ -398,11 +398,11 @@ public class VirtualFilePointerTest extends PlatformLangTestCase {
|
||||
PlatformTestUtil.startPerformanceTest("VF container create/delete",200, new ThrowableRunnable() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
Disposable parent = Disposer.newDisposable();
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
Disposable parent = Disposer.newDisposable();
|
||||
myVirtualFilePointerManager.createContainer(parent);
|
||||
Disposer.dispose(parent);
|
||||
}
|
||||
Disposer.dispose(parent);
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.ListIterator;
|
||||
|
||||
public final class ObjectNode<T> {
|
||||
private static final ObjectNode[] EMPTY_ARRAY = new ObjectNode[0];
|
||||
@@ -73,7 +74,13 @@ public final class ObjectNode<T> {
|
||||
void removeChild(@NotNull ObjectNode<T> child) {
|
||||
synchronized (myTree.treeLock) {
|
||||
assert myChildren != null: "No children to remove child: " + this + ' ' + child;
|
||||
myChildren.remove(child);
|
||||
ListIterator<ObjectNode<T>> iterator = myChildren.listIterator(myChildren.size());
|
||||
while (iterator.hasPrevious()) {
|
||||
if (child.equals(iterator.previous())) {
|
||||
iterator.remove();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user