Performance issue with word wrap #11
Labels
No labels
Area-Accessibility
Area-Build
Area-CodeCompletion
Area-Document
Area-Documentation
Area-Editing
Area-Folding
Area-Highlighting
Area-i18n
Area-Indentation
Area-NetFx
Area-Rendering
Area-Search
Area-Snippets
dependencies
duplicate
Feedback Needed
help wanted
invalid
Issue-Bug
Issue-Discussion
Issue-Enhancement
Issue-Performance
Issue-Question
on-hold
Resolution-Answered
Resolution-By Design
Resolution-Duplicate
Resolution-Fixed
Resolution-Won't Fix
Up-for-Grabs
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-icsharpcode/AvalonEdit#11
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I use AvalonEdit to display XML data, and sometimes that data include really long lines without spaces (at most it's 25MB byte[] data encoded as base64).
When I enable WordWrap performance drops really bad.
And even with WordWrap disabled lines are still wrapping after 9600 symbols, so performance drops to unacceptable levels in worst case. Workaround is checking string and splitting lines by 8000 symbols - then performance is OK
This is a known problem. AvalonEdit isn't really designed to handle long lines, and WPF has some strange performance bugs with them -- I tested this some time ago, and WPF rendering time increases linearly with the line length up to some strange font-dependent limit (this might be the 9600 in your case), where it will suddenly start to word-wrap. Increasing the line length above this limit then causes quadratic growth in the time taken.
I'm not sure what causes WPF to act so strangely. Truncating the lines is a good workaround. Note that you don't have to truncate the document text, you can instead truncate by extending the AvalonEdit rendering pipeline:
Usage:
editor.TextArea.TextView.ElementGenerators.Add(new TruncateLongLines());This causes lines to be truncated similar to folding -- the rendering layer only gets to see the truncated text and is more performant, but selecting the whole line and copying it to the clipboard causes the whole text to be copied, not just the truncated version.
Also, for performance: