Hello,
I 'm loading a tree in Outlook Express mode with approax 1000 folders (deepest folder level is 7) and 5000 items. It takes about 1 minute to load. I have analyzed performances with a tool, and I can see that most of time is spent in : SetCellValue and UltraTreeColumnSet.DirtySortForAssociatedNodesCollections(UltraTree) .
I have just 5 columns to set and if I remove columns sorting, result is the same. I have tested with 2007.3(hot fix 1061) and 2008.3 versions.
Is there any options to set to accelerate loading in that case ?
Thanks.
Here is a capture of performance analysis: It shows where time is spent
Hi Mike
This is not improving performances. here is sample code of what we are doing to load tree:
public void LoadEntities(UltraTreeNode parentNode, IEnumerable<BaseObject> list) { foreach (BaseObject item in list) { AddItem(parentNode, item, false); } }
public UltraTreeNode AddItem(UltraTreeNode parentNode, BaseObject item, bool useParentGUID) { if (item == null) return null;
UltraTreeNode tn; if (parentNode == null) tn = utEntities.Nodes.Add(null, item.Name); else tn = parentNode.Nodes.Add(null, item.Name);
try { if (useParentGUID) tn.Key = item.ParentGUID + "_" + item.GUID; else tn.Key = item.GUID; } catch { }
tn.Tag = item; SetTreeNodeColumnsValue(tn, item);
return tn; }
private void SetTreeNodeColumnsValue(UltraTreeNode treeNode, BaseObject item) { if (item == null) return;
treeNode.Cells["Name"].Appearance.Image = IconManager.instance.GetIcon(item); treeNode.SetCellValue(colGuid, item.GUID); treeNode.SetCellValue(colName, item.Name); treeNode.SetCellValue(colDesc, item.Description); if (item.Type != GenesisType.Folder && item.Type != GenesisType.Library) treeNode.SetCellValue(colType, GetEntityTypeCaption(item));
if (item.Type != GenesisType.Folder && item.Type != GenesisType.Library) treeNode.SetCellValue(colModified, item.ModificationDate); if (filterCtx.DsType == DataSourceType.Shared) treeNode.SetCellValue(colCOB, item.CheckOutUser != null ? item.CheckOutUser : "");
// Set Visual state when entity is opend if (EntityWatcher.Instance.IsEntityOpened(item.GUID)) treeNode.Cells["Name"].Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True; else treeNode.Cells["Name"].Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.False; treeNode.Tag = item;
}
I will join summary of our performance tool.
Thanks for your help
Try calling tree.BeginUpdate before you start adding nodes and then call EndUpdate after the last node is added. That should speed it up.
If that does not help, perhaps if you post the code here that adds the nodes, we can take a look and see if it can be made more efficient.