Scrolling performance and number of lexer calls

SyntaxEditor for WPF Forum

Posted 11 years ago by Robin Neatherway
Version: 13.1.0582

We have a SyntaxEditor component hooked up to a custom programmatic lexer. Document navigation is rather slow and it seems to be due to very large numbers of calls being made into the lexer.

For example, when Page Up is pressed at the bottom of a test document, the following pattern is observed:

  1. The visible region becomes lines 3182 to 3215.
  2. Lines 3182 to 3215 are requested to be lexed one at a time, as expected.
  3. Next lines 3183 to 3215 are requested, not expected.
  4. Repeat starting from earlier and earlier lines back to 3147 (approximately another page's worth of lines).
  5. The lexed range does not always include all lines up to 3215, sometimes stopping at 3182.
  6. In all almost 4000 lines are lexed.

It is difficult to track down what is responsible for requesting these lexing operations. Do you have any tips on why this might be happening and how we could track it down?

Comments (3)

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

Hi Robin,

I did a quick test and I'm not seeing that happen.  In my test, it only requested each line once, as expected.  Can you reproduce this in one of our samples as-is?

Or if not, perhaps make a new simple sample project that shows the issue and email that to our support address.  Reference this post and rename the .zip file extension so it doesn't get spam blocked.

Actipro Software Support

Posted 10 years ago by Robin Neatherway


Thanks for the reply. Creating a simple sample is going to be nontrivial unfortunately. Could you first let me know exactly what triggers the SyntaxEditor to make calls to the lexer so that we can check that we aren't accidentally causing this to occur repeatedly?




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

Hi Robin,

It's generally just as view lines are being prepared to display, since that's where the classification and other tag information is needed.

However if you are doing a lot of changes to a tagger that affects UI and keep firing the TagsChanged event on it, that will trigger view lines to be rebuilt, and taggers called again.  I'd search your code for someplace where you are raising TagsChanged a lot.  Note that if you are using a CollectionTagger, that will fire the event in response to any collection updates.  You can minimize those events by doing batch updates (see tagger documentation).

Actipro Software Support

The latest build of this product (v23.1.4) 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.