This is a migrated thread and some comments may be shown as answers.

Working with larger files

1 Answer 74 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Doug
Top achievements
Rank 1
Doug asked on 26 Jun 2016, 01:58 AM
 For medium to larger size files (10k words to 100k words) I'm having trouble with performance. CPU usage is actually quite low, but the control is under performing the larger the files become.  For example:

 

I have a 10k word file. Search is lightning faster (fantastic), but replacing is horribly slow, ~10 inserts per second (this gets worse as the file grows). I've wrapped the replace process in a Begin and EndUndoGroup, but that seems a nominal improvement. (see pseudo-snippet below) 

I also have a 100k word file that is essentially unusable in the control. It is plain text, no images or extraneous formatting. It takes 1-5 seconds for keystrokes to register. I've throttled documentchanged event to 10 seconds. After importing the same document into the Telerik demo project (TelerikEditorDemo_WPF) I'm noticing the same performance issue. Again, cpu usage is quite low.

Is there any optimizations that can be done to help with these issues?

 

With UI virtualization is it normal to see 1G+ memory usage by opening up a ~100k word document (700KB file)?

My grid containing the control (row 1)...

<Grid.RowDefinitions>
            <RowDefinition
                Height="117" />
            <RowDefinition
                Height="*" />
            <RowDefinition               
                Height="20" />
        </Grid.RowDefinitions>

 

// Replace functionality below

Editor.BeginUndoGroup();

foreach (TextRange range in Results)

{

    RadDocument.Selection.Clear();                
    RadDocument.CaretPosition.MoveToPosition(range.StartPosition);
    RadDocument.Selection.AddSelectionStart(range.StartPosition);
    RadDocument.Selection.AddSelectionEnd(range.EndPosition);

    Editor.Insert(replaceText);

}

Editor.EndUndoGroup("Replace"); 

1 Answer, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 29 Jun 2016, 04:33 PM
Hi Doug,

There are indeed some distinctive areas of RadRichTextBox where we've identified areas for improvement of the control's performance. In fact, the Replace All functionality is one of those areas and I will make sure your feedback about this reaches the team.

The diminishment when editing large documents is actually logged on our public portal and I would suggest subscribing to the public item in order to get notified about status changes: Improve editing performance for large documents. 

Concerning the memory usage when loading a large document, the UI virtualization of RadRichTextBox allows reusing of the visible boxes but each document is still imported completely and translated to the internal RadDocument structure. That said, the results you are seeing are expected.

Due to the nature of this, there are not many options that I can suggest and would improve the performance for you. One thing you can explore is disabling of the default RadRichTextBox functionalities in case you are not using them. For example, you can recreate the UI layers builder and remove some of the default layers, e.g. RevisionChangedLinesDecoration if you are not using track changes. Another thing I'd encourage you to consider is disabling the spell checker if this is an option for you. 

I hope this is useful. 

Regards,
Petya
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
RichTextBox
Asked by
Doug
Top achievements
Rank 1
Answers by
Petya
Telerik team
Share this question
or