I've got some performance problems when using an IOutliner with a large document.
I've got a large document of ~10MB/100K lines. When I open this document without an Outliner the call to SetText is done within a second. But when I have an outliner with a simple TokenOutliningSourceBase it takes about 30 seconds for the document to load, and it freezes the UI thread.
I've already set the AmbientParseRequestDispatcherProvider.Dispatcher to a new ThreadedParseRequestDispatcher.
When I add this line of code to my SyntaxLanguage constructor the loading of the document goes from ~1sec to ~30sec
this.RegisterService<IOutliner>(new ActiproSoftware.Windows.Controls.SyntaxEditor.Outlining.Implementation.TokenOutliner<ScriptOutliningSource>());
My ScriptOuliningSource implementation is as follows
protected override OutliningNodeAction GetNodeActionForToken(IToken token, out IOutliningNodeDefinition definition)
{
switch (token.Key)
{
case "MultiLineCommentStartDelimiter":
definition = multiLineCommentDefinition;
return OutliningNodeAction.Start;
case "MultiLineCommentEndDelimiter":
definition = multiLineCommentDefinition;
return OutliningNodeAction.End;
case "OpenCurlyBrace":
definition = curlyBraceDefinition;
return OutliningNodeAction.Start;
case "CloseCurlyBrace":
definition = curlyBraceDefinition;
return OutliningNodeAction.End;
default:
definition = null;
return OutliningNodeAction.None;
}
}
Is there any way to solve the problem of the blocking UI?