We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Reading text into strings is slow using CurrentLineText

I am currently working on a section of my VB.NET project that needs to read out all the text lines in an EditControl and process them. I found that EditControl.CurrentLineText is very slow - about 2mS/line. I tested a 30 line test file with the following code:

For i = 1 to 100    'Do it 100 times to make timing easy
    For l = 1 to Editor.PhysicalLineCount
                Editor.CurrentLine = i

With the Process() doing nothing, the above takes ~6 seconds, or 20mS per line.

I have found however that if I do this:

For i = 1 to 10000    'Do it 10000 times to make timing easy
    For l = 1 to Editor.PhysicalLineCount


It is about 100 times faster. In fact, I increased the loop count to 10,000 and got about the same 6 seconds total.

Posted in the hope it may help others :-)

                    David Stonier-Gibson

  SPLat Controls Pty Ltd               http://splatco.com
Ph +61 3 9773 5082                       Fx +61 3 9773 5091
   LinkedIn: http://au.linkedin.com/in/davidstoniergibson
 *** This email does not constitute professional advice **
   Free newsletter  http://splatco.com/control_matters/
       Terms of sale: http://splatco.com/skb/2097.htm

2 Replies

AD Administrator Syncfusion Team April 18, 2013 09:04 AM UTC

Oops. I should be processing line Ell, not Eye.

PA Paul Anderson S Syncfusion Team April 24, 2013 11:41 AM UTC

Hi David,

Thanks for your interest in Syncfusion products,

In EditControl the CurrentLineText is used for many operations. Hence when we use that it will take some time to process all the operations related to that when it is used. But GetLineText gets only the text of the given line and its not involved in any other operations and hence its execution is faster compared to CurrentLineText. Thanks for your update regarding this.

Please let us know if you have any concerns.

Paul Anderson S

Live Chat Icon For mobile
Up arrow icon