-
Notifications
You must be signed in to change notification settings - Fork 819
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
Textarea is slow when pasting things from the clipboard #831
Comments
Hi! Thanks for the report. I believe there two items that will improve the situation here:
|
Oh, I did not see there were current issues and PRs about this 🤔 Amazing project BTW 🦾 |
I have "hacked" textarea to be significantly faster. After profiling, I found Here is a sketch of the solution, I built a LRU memoization cache here: https://github.com/go-go-golems/clay/blob/main/pkg/memoization/memoization.go Here is the "hacked" textarea: wesen/bubbles@30a4341 I was able to easily copy paste longer sections of text: https://asciinema.org/a/Dab4MlcIxaWinhJwQC3kU9fCV |
@wesen That's actually a clever solution without changing anything of the rest of the bubbletea source code. Why don't you do a PR and include the I am not a mantainer of the library or anything, just a regular user, but from my point of view this does not looks hard to integrate. It could be a temporal solution before they integrate this PR (#397) @meowgorithm what do you think? |
Yeh, just chiming to say that textarea copy/pasta is not really that usable at all atm due to this performance issue. Thanks for raising the issue! |
Bumping |
Please merge #427! |
Hey everyone. Just a note that we're looking into bracketed paste (#397) which should alleviate some of the performance woes. It's a delicate one to execute on properly, and will need some additional changes beyond that PR in practice, so note we're examining the solution carefully. @nadimkobeissi #427 was merged a long time ago. Perhaps a typo? |
Have been doing profiling of this issue and discovered a very simple change that causes a nearly doubling of performance. Swapping out the Benchmark results
Code used for benchmarks:
Iteration count was only I would also recommend replacing the Be aware, for the full benefits, I would recommend this change being applied to I have no problems putting up the pull requests for all impacted repositories, however I would like confirmation this aligns with the project directions before I begin the work. |
Well that's awesome. We've noticed |
We just merged memoization to improve Thank you for the well-written issue @cruizba and for the well-done implementation @wesen! |
@mikelorant, thanks so much for the information and benchmarks. We've swapped in
When the |
Unfortunately,
However, for the sake of complete benchmarks I have compared the two packages.
Code used for benchmarks:
The easy answer, there is no benefit to swap out the The complicated answer, we should never be using I do not wish to add to this closed issue with further details on how we should approach the replacement of |
@mikelorant I've spent some time today working on For the reasons I mentioned in the comment you quoted above, I would advise against handling runes in isolation, as you do in the |
@rivo Can confirm some very nice performance benefits. I've also taken the opportunity to continue to do some CPU profiling and think you may have 2 places worth investigating if you want to squeeze some more improvements in. I may be very wrong about this (fairly new to CPU profiling) so I may not be reading this correctly. |
The It seems to me that you're still using the |
Will reply to you on the |
Absolutely giant increase in performance with muesli/reflow#71. All thanks to @rivo for this one. @wesen You might want to try updating your |
Just did some very quick benchmarks of my own app with pasting 1000 characters (14 lines) into a textarea of 72 characters wide: Before: For context, no optimisations to my own app code at all. All these performance increases came from:
Very happy with the results. |
Describe the bug
Copy and paste things in textarea breaks somehow the fast user experience while using it in a CLI tool.
When you paste a large text into a textarea, all characters are written one by one.
Also, I've noticed that, the larger the text is and the more number of lines it has, user input slows down incrementally.
Setup
Please complete the following information along with version numbers, if applicable.
To Reproduce
Steps to reproduce the behavior:
CharLimit
of the TextArea to a high value (so large texts can be pasted) and paste a large file. I am actually pasting a PEM file (a certificate) which has 28 lines and 65 characters per line.Source Code
https://github.com/charmbracelet/bubbletea/tree/master/examples/textarea
Expected behavior
It should be fast on pasting things to not break the user experience.
The text was updated successfully, but these errors were encountered: