-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazy TreeViewer reveal is quadratic on Linux #649
Comments
@basilevs : did you intentionally created this in platform.ui tracker and not in SWT, or should it be moved to SWT? |
@iloveeclipse JFace TreeViewer forces eager creation of all sibling TreeItems for the one being revealed (see TreeViewer.createChildren()), so it is responsible for linear complexity. SWT seems to contribute another nested linear complexity. |
@basilevs : I have no idea here, haven't looked into code. Feel free to attack from whichever side you like :-) |
I suspect (have not checked) SWT/GTK complexity comes from native code, which is harder to deal with. |
Related demonstration #975 |
GTK returns children count in O(N): static gint
gtk_tree_store_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GNode *node;
gint i = 0;
g_return_val_if_fail (iter == NULL || iter->user_data != NULL, 0);
if (iter == NULL)
node = G_NODE (GTK_TREE_STORE (tree_model)->priv->root)->children;
else
node = G_NODE (iter->user_data)->children;
while (node)
{
i++;
node = node->next;
}
return i;
} |
|
Moved from Bug 516281
On large lazy tree models,
TreeViewer.setSelection()
andTreeViewer.reveal()
are very slow.Test steps
Import attached Eclipse project in a PDE
Add native SWT fragment to included launch configuration TreeViewerPerformanceTest.
Alternatively create your own launch configuration to start TreeViewerPerformanceTest Junit plug-in test.
Run the configuration/test
Expected
For virtual trees, the time to render should not depend on the model size.
Actual
On MacOS and Windows the time taken is at most linear, on Linux, reveal is very slow (quadratic).
MacOS
52 ms to process 10000 items
458 ms to process 100000 items
The time to select scales as O(n^0.94) as the size of the model grows from 10000 to 100000
36 ms to process 10000 items
384 ms to process 100000 items
The time to reveal scales as O(n^1.02) as the size of the model grows from 10000 to 100000
Windows
9 ms to process 10000 items
12 ms to process 100000 items
The time to select scales as O(n^0.16) as the size of the model grows from 10000 to 100000
6145 ms to process 10000 items
59166 ms to process 100000 items
The time to reveal scales as O(n^0.98) as the size of the model grows from 10000 to 100000
Linux
5 ms to process 10000 items
34 ms to process 100000 items
The time to select scales as O(n^0.83) as the size of the model grows from 10000 to 100000
3888 ms to process 10000 items
396560 ms to process 100000 items
The time to reveal scales as O(n^2.01) as the size of the model grows from 10000 to 100000
Example of a hot stacktrace:
Sampling profiler results:
The text was updated successfully, but these errors were encountered: