Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java TreeViewer.expandAll方法的性能_Java_Performance_Eclipse Plugin_Eclipse Rcp - Fatal编程技术网

Java TreeViewer.expandAll方法的性能

Java TreeViewer.expandAll方法的性能,java,performance,eclipse-plugin,eclipse-rcp,Java,Performance,Eclipse Plugin,Eclipse Rcp,在我的应用程序中,一个操作是展开某棵树的所有元素 每次执行此操作时,所需的时间都比以前长 long startTime = System.currentTimeMillis(); getTreeViewer().expandAll(); long endTime = System.currentTimeMillis()-startTime; System.out.println("expandAll time : " + endTime ); 这是一个来自输出的样本 所有时间:200 所有时

在我的应用程序中,一个操作是展开某棵树的所有元素

每次执行此操作时,所需的时间都比以前长

long startTime = System.currentTimeMillis();
getTreeViewer().expandAll();
long endTime = System.currentTimeMillis()-startTime;
System.out.println("expandAll time :  " + endTime );
这是一个来自输出的样本

所有时间:200 所有时间:800 全年:1800 全年:3200


--这让我的插件速度下降了很多。这是该方法的问题吗?

是否有过滤器?过滤器和其他TreeViewer协作器在展开操作时被调用。还要检查LabelProvider的实现,看看在计算每个新显示的树项目的文本标签和图像时是否需要一些时间。

是的,我有一个过滤器。但即使我禁用了它,我的性能也一样。我使用EclipseMF生成的提供程序作为标签和内容提供程序OK。在ContentProvider上公开了多少树项,getChildren()方法的开销有多大?大约100项。getChildren需要一些毫秒。ex:getChildren在expandAll中花费7毫秒:1926毫秒您还可以查看expandAll()中由getRoot()调用的getInput()方法。与expandAll中的createchildren相比,getInput也不花费时间