Loading large single-line text is very slow.

SyntaxEditor for WPF Forum

Posted 3 years ago by Sunshine - Appeon
Version: 21.1.2
Avatar

For example, a 600K Css production-level file would have 600,000 characters on a single line.Such files often appear in the project directory after the front-end project is compiled.

Although it is almost unreadable, it takes a long time when the user clicks to open it.

There are two main problems I have encountered so far:

(1)For a large 600K single-line file, Document.Loadfile() method takes about 2 seconds to load. Is there any way to optimize this?

(2)After Document.LoadFile() I want to use the properties on the Document to determine whether the file is a single-line large file to decide whether to register the syntax service.But I don't know when this judgment should be made. When Document.LoadFile() is finished, SyntaxEditor.Document doesn't have any content.

Comments (1)

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

Hello,

1) We know that it takes a while for WPF's text formatter to run on extremely long lines of text since it has to determine the total width of all the characters on that line for scrollbar max purposes, character bounds for hit-testing, word wrap if that is enabled, and so on.  The only way to really optimize it at this time is to break up extremely long view lines into shorter lines.

2) I tested Document.LoadFile() here and it seemed to work ok.  Please let us know how to reproduce what you are seeing where it's not loading text.

I think the main performance bottleneck with long lines is when formatting view lines.  If you load the document standalone (without a SyntaxEditor attached), you can probably load a document with long lines very quickly, and then adjust it as needed prior to assigning it to the SyntaxEditor.Document property.


Actipro Software Support

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