Performance problem on WPF SyntaxEditor ILexer

SyntaxEditor for WPF Forum

Posted 6 years ago by Roger
Version: 17.1.65
Platform: .NET 4.6
Environment: Windows 10 (64-bit)
Avatar

We are migrating SyntaxEditor from Winform to WPF.

We have a lexer performance problem that we implemented.
The lexer implements ILexer, and we registered several providers to SyntaxLanguage.
The lexer performance is average 1.16ms per one lexical parse to get 10 token results.
We feel delay when we paste 10 lines of codes to the editor that is using the SyntaxLanguage.
In present state, the sequence of parsing call is lexical parse -> semantic parse -> lexical parse from tagger.

Winfom SyntaxEditor does not call the lexer frequently and there is no performance problem.
We use same lexer codes on WPF and we have performance issue.

Do you have any way to reuse the lexical parse results that we parsed last time?
And, what is key point to implement for performance?
And, we would like to know what we can do to improve the performance?

[Modified 6 years ago]

Comments (1)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Roger,

It's hard to say what the problem is without a new simple sample project that we can debug with.  But in general, both WinForms and WPF lexers will execute whenever you type.  The WinForms one will try and make sure the entire document is lexed and up-to-date whereas the WPF one will only lex through what is needed to render lines.  Thus, the WPF one loads larger files much faster and should be faster in general.

If you are calling a semantic parser (via IParser service in the WPF version), perhaps you didn't set up the ambient parse request dispatcher?  That is needed to ensure the parsing runs on a worker thread and doesn't block the UI thread.

Assuming you have that configured right, you should be able to load and type without any noticable delays.

If you'd like us to look, please email our support address with a new small sample project showing the issue.  Remove any bin/obj folders from the ZIP you send and rename the .zip file extension so it doesn't get spam blocked.  Thanks!


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.