Syntax editor becomes slow and scroll is choppy

SyntaxEditor for Universal Windows Forum

Posted 9 months ago by Rohit
Version: 17.2.0320
Avatar

The editor and scroll works fine if I have short text in each line, but it is very choppy and slow when every line contains long text.

Example,

If I have Lorem; i.e. less than 20 characters in a line and over 1200 of such lines, scroll is smooth and okay (acceptably fast). Editor works fine.

But if I add Lorem Ipsum Porem, Lorem Ipsum Porem, Lorem Ipsum Porem,..... Lorem, Ipsum, Porem; i.e. over 220 characters in each line and just over 40 of such lines in editor, then editor becomes slow. That includes, loading of such text in editor, vertical-horizontal scroll, modifying text of a line and other similar operations. 

We have an application where user can have up to 75000 lines in single instance. Application will be run on a windows 10 tablet with 2GB RAM.

Can you please help me figure out the root cause and fix to this problem, sooner ?

Comments (12)

Posted 9 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

The UWP SyntaxEditor's performance is currently hampered a bit by its implementation.  When we originally wrote it for WinRT (before UWP), we had to use multiple TextBlock controls to render text in the editor since there was no other way to do so.  We effectively are adding/updating/removing TextBlocks constantly as you type and scroll.

Later on, Win2D was added by Microsoft which allows for fast text rendering, but it's a massive change to switch to it.  We have already done this switch to Win2D as part of the "SyntaxEditor vNext" project described in our blog, which will end up being the 2019.1 version of the UWP SyntaxEditor.  I suspect this will fix the performance issues you see since creating/updating/removing TextBlock elements like we currently have to do in the 2018.1 UWP version is a performance bottleneck.  And editing/scrolling in the UWP vNext version is super-fast. 

Keep an eye on our blog for more vNext news, as we will eventually be asking for beta testers.  Feel free to e-mail us at our support address if you'd like to sign up ahead of time to be a UWP vNext beta tester.


Actipro Software Support

Posted 9 months ago by Rohit
Avatar

thanks.

when do you expect to release "SyntaxEditor vNext" 2019.1 ?

Posted 9 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

While we can't offer a date at this time, we are probably within the last 10% of development of the UWP vNext version.  Please watch our blog for updates.


Actipro Software Support

Posted 6 months ago by Ravi Kumar Thakur - Associate Tech Specialist, ABB
Avatar

Hello Actipro Support,

We downloaded the sample app from the Microsoft Store. 

Opened the c# demo (.net Lang. Add-on)

In the sample program we created a single line with 1000 characters and copied to 500 lines in source program on the Actipro Sample app's Syntax Editor.

We scrolled the program on the SyntaxEditor control, we had following issues.

1. The scroll was choppy and cluttered. Jumps to the start of the program and then back to the scrolled line.

2. If any selection was made in the source code in the editor, if scroll is performed when selection is still there, the cursor (Scroll) jumps back and forth between the selected lines and lines being scrolled. 

These issues are very consistent and happens when the lines are long.

Following Sample program was opened in the Actipro's Syntax editor:

/// <summary>
/// Advanced C# code editing for your end users with the
/// .NET Languages Add-on for Actipro SyntaxEditor.
/// </summary>
public class CSharpLanguage {

/// <summary>
/// Edit this document to see background parsing
/// update automatic outlining, the document outline
/// (AST), and syntax errors.
/// </summary>
public void DemoTest() {
string errorTest = "Hello";

//Line1
Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);

//Line2
Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);

....

....

....

//Line 500

Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);Console.WriteLine(errorTest);

}

}

Regards Ravi

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

Hi Ravi,

Thanks for evaluating SyntaxEditor.  

1) Yes, the current UWP SyntaxEditor was written before there were ways in UWP to render text quickly.  So it is effectively building TextBlock objects and moving them around to render the text in the editor behind the scenes.  We are currently working on a "SyntaxEditor vNext" project (described in our blog) where in the UWP version, we have harnessed a newer DirectX way of rendering the control and the performance with those updates is now just as good or better than the currently much quicker WPF version.  We hope to launch a beta of the UWP SyntaxEditor vNext version for testing in the next several weeks once we wrap up its updates.

2) For #2, can you tell us exact steps to reproduce this so we can see it?  So far I haven't been able to see what you describe.  Also of note, the selection and caret rendering mechanism has been reworked in the "vNext" version, so that will likely behave better.


Actipro Software Support

Posted 6 months ago by Ravi Kumar Thakur - Associate Tech Specialist, ABB
Avatar

Hello Actipro Support,

Thanks for prompt response.

Further info on the issues:

We use the ActiPro's syntax editor control in our app that runs on the windows 10 tablet PC with 2GB RAM. Both of the above issues can be seen consistently. This has caused major UX issues in our app when the lines are pretty long.

For Issue 2 reproduction:

In the syntax editor on tablet device, tapping the line selects the complete line, after selection when user tries to scroll the issue 2 appears.

Observation:

we observed that the GetNextToken method from the MergableLexerBase class is repeatedly called for each character on the OnPointerWheelChanged event which causes character by character parsing of the entire source code module loaded in the syntaxeditor, if user scrolls through the code in the syntax editor this causes issues 1 & 2.

I assume that parsing the text is the required behavior for displaying the syntax colouring and other adornments in the editor when the text is loaded in the editor, however, I would like to know it there is any possibility that in case when user scrolls a call to method "MergableLexerBase.GetNextToken" could be avoided when user just scrolls and doesn't perform any modifications on the source code in syntax editor.

Question:

What is the release plan for the "SyntaxEditor vNext"?

Thanks

Ravi

[Modified 6 months ago]

Regards Ravi

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

Hi Ravi,

Thanks for the info.  We will dig in some more in the next few days and will let you know if we have any questions.

We are still finalizing the UWP version's code.  Since we use DirectX now to render the control in that version there are some graphics device related issues popping up that we need to handle.  Once we get that stabilized and tested, we'll start to open things up for a beta test.  Please watch our blog for news of that.


Actipro Software Support

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

Hi Ravi,

I did some testing with the latest UWP SyntaxEditor vNext codebase (which again has major infrastructure changes over the current release version) and I'm not seeing any scrolling jumpiness like you mentioned where it would flicker back to the beginning of the program.  I'm seeing the editor scroll smoothly in the vNext code.  And if the caret is at the end of a long line, scrolling with mouse wheel is smooth as well.

I also put a breakpoint in the GetNextToken call and it's only calling that in vNext when a new view line is needed.  We cache up to a certain number of view lines for performance reasons.  That cache gets cleared on certain updates, and of course a view line being scrolled into view that hasn't yet been rendered wouldn't be in the cache yet.  But basically once the editor was displayed and I mouse wheeled up and down quickly within a small range of lines to load up the cache, if I then put a breakpoint in the GetNextToken call, it never got hit until I scrolled past the lines that were cached.


Actipro Software Support

Posted 6 months ago by Ravi Kumar Thakur - Associate Tech Specialist, ABB
Avatar

Hello Actipro Support,

Good to hear that the issues reported about choppy scroll and scrolling jumpiness are not evident in the latest vNext Syntax Editor.

We would like to try out the scroll scenarios on our Target device in our software,

Would it be possible to obtain a working version of Latest Syntax editor for testing (alpha or beta version) so that we can confirm on our target device that the issue are not evident as claimed for the newer version.

If it is immediately possible to share the latest beta/alpha version of syntax editor please send us the details.

If not alpha/Beta, then can we get a working version, only to test scroll issues, please share the required components.

Regards Ravi

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

Hi Ravi,

Great, and I think one of your co-workers asked to be a beta tester too.  We don't have a beta distribution ready just yet but I've added you to our beta tester list and will let you know as soon as one is ready.  We hope to have the first beta ready in the next week or two.

While I'm writing, can you tell us what your UWP app's target platform version and minimum version settings are in the project properties?


Actipro Software Support

Posted 6 months ago by Ravi Kumar Thakur - Associate Tech Specialist, ABB
Avatar

Hello Actipro Support,

We have immediate requirement to test the said functionality on our target device. It is not feasible for us to wait for the beta to be released, Please share details of any working version of the vNext SyntaxEditor for us to validate the scroll functionality.

We use a windows 10 based Tablet PC with 2 GB of RAM for running our application.

Following is the UWP Target platform version information for the target device:

Target Version : Windows 10, version 1809(10.0;Build 17763)

Min Version : Windows 10 Creators Update (10.0; Build 15063)

Regards Ravi

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

Hi Ravi,

Please contact us offline by writing our support address and mention this thread.  We can discuss further there.


Actipro Software Support

The latest build of this product (v2019.1 build 0341) 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.