Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very slow operations in a TextBox with large amount of characters #7275

Open
luthfiampas opened this issue Dec 28, 2021 · 3 comments
Open

Very slow operations in a TextBox with large amount of characters #7275

luthfiampas opened this issue Dec 28, 2021 · 3 comments

Comments

@luthfiampas
Copy link
Contributor

luthfiampas commented Dec 28, 2021

Describe the bug
Operations in a TextBox control (such as selecting, typing, clicking) with 50000+ characters is very slow, and it uses 100% of CPU.

To Reproduce

  1. Create TextBox control
  2. Add 50000+ characters
  3. Start selecting text either with mouse or keyboard, typing or change caret position

Expected behavior
Faster operations.

Screenshots

textbox.mp4

Desktop (please complete the following information):

  • OS: Windows 10, Arch (KDE), Debian (dwm)
  • Processor: i7-9700F @3.0GHz
  • RAM: 16GB
  • Version: 0.10.10
@luthfiampas luthfiampas changed the title Very slow selection in a TextBox with large amount of characters Very slow operations in a TextBox with large amount of characters Dec 28, 2021
@Gillibald
Copy link
Contributor

Gillibald commented Dec 28, 2021

I don't see an issue here. TextBox isn't designed to deal with that scenario. I suggest using AvaloniaEdit.

@luthfiampas
Copy link
Contributor Author

@Gillibald Looking at the WPF's TextBox or GTK's TextView, they can handle large text content very nicely. Seems that I pick the wrong label for this issue.

@maxkatz6 maxkatz6 added enhancement and removed bug labels Dec 28, 2021
@Gillibald
Copy link
Contributor

Gillibald commented Dec 28, 2021

This is only slow because of selection highlighting. Each selection change causes a new text layout pass for the whole text. Nothing is cached or virtualized. WPF caches some portion of the text layout and isn't creating a new string each time the text is edited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants