assigning a text to syantax editor is taking long time

SyntaxEditor for Windows Forms Forum

Posted 7 years ago by dinesh hegde
Avatar
Hi ,

I have a code like this in my control.

this.actiSyntaxEditor.Text = value;

Above particular code takes long time..I am assigning a text to it.

Any idea.?

Comments (6)

Posted 7 years ago by Tobias Lingemann - Software Devolpment Engineer, Vector Informatik GmbH
Avatar
Well, when you set the text property, everything must be updated.
Depending on what your language is doing and how long the text is, that can take some time.
If you are just updating the text, you should use the ReplaceText(), AppendText() or InserText() methods of your document. This way the lexer and several updates only analyze the new code.

But first of all you should know what part really slows down your application. Is it the parser? Does your parser run in an background thread? Is it an action that is triggered by the new parse data? Normally the lexer related parts should be pretty fast. If you have a dynamic lexer, you could write a programmatic lexer.


Best regards, Tobias Lingemann.

Posted 7 years ago by dinesh hegde
Avatar
Thanks.

Here length doesn't matter.. When I open the dialog for first time, I try to add some text to it. it is 4 letter long. For the first time when you are assigning it takes longer time. I am just doing SyntaxEditor.Text= value (let us say this value is "test").Subsequent add call will not take time.

There is nothing I am running in background. it is only that assignment taking time. I have no clue where it is going wrong..
Posted 7 years ago by Tobias Lingemann - Software Devolpment Engineer, Vector Informatik GmbH
Avatar
I'm not sure I can follow you.
There is no scenario, where that could lead to a freezing GUI. I mean, we are not talking about some milliseconds, right? I cant even measure a single tick when setting the text for the first time, not to mention even a millisecond.

Do you have your own language with lexer and parser? Or what language does your editor use? Is it a dynamic language (xml-file).

If you have a profiler (e.g. ANTS Performance Profiler) you could analyze the performance.

Or if you just could make a sample project that would demonstrate the issue.


Best regards, Tobias Lingemann.

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Tobias, thanks for assisting here.

Dinesh, if it only happens the first time that sounds like perhaps the assemblies are taking a while to do their initial load. But normally you'd encounter that sort of issue (if it is what is happening) the first time you reference the SyntaxEditor control at all. If your GUI with SyntaxEditor has already loaded, then that would not be the case here.

We've only seen assemblies take a while to load if you use code signed assemblies on a computer that doesn't have network access. We have a knowledge base article on that issue, and it's something due to .NET. Otherwise it all should load very fast.

Setting the text property to something small like that should absolutely be instantaneous and we haven't heard of anything to the contrary. If you see the slowdown happening when executing that line only, then please use a profiler like Tobias said (ANTS or dotTrace) to narrow down the cause. I don't think it would be anything on our end though. Perhaps you handle some sort of text change even in which you trigger something that slows performance of your app.


Actipro Software Support

Posted 7 years ago by dinesh hegde
Avatar
Thanks...I would use ANTS and find out..But it is just that code which takes some time for the first time when you open the dialog. It happens always when you open the dialog. But subsequent add just works. I am sure assemblies are loaded already..
Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I would recommend you show a MessageBox right before that line and then another one again right after. Then run your app with ANTS. When you hit the first MessageBox, start the profiling session and then stop it when you hit the second MessageBox. That should tell you what is going on.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 6 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.