GNOME Bugzilla – Bug 748704
Quadratic behaviour when pasting very long lines
Last modified: 2015-05-27 09:53:35 UTC
Try making a really, really long line (say 20000 characters) somewhere, e.g. in an editor. Then paste it into a terminal window. The first many characters of output are inserted quickly, but after some time the terminal slows down. To me it looks like there's an O(n^2) algorithm somewhere in there. At some point it gets so slow that it's unusable. In practice, I encounter this annoying problem when pasting long commands to a remote server.
Maybe I should add that the 20k is just a suggestion that probably won't break your terminal completely. Try 200k instead to see what I mean by unusable.
Are you sure it's a problem with the terminal emulator? I find it more likely that it's an O(n^2) behavior in whichever app you're pasting to (e.g. a console editor, or the shell). See also bug 539312.
Hm, interesting. I'm seeing this with bash, psql (Postgres client), Python among others. But I suppose it could be something in GNU readline. I just tried bash with --noediting and it's fast! Okay, sorry about that, I'll close the bug, thanks for the quick response.
Just in case anyone else stumbles upon this: I reported the problem in readline, and it looks like there's a fix now https://lists.gnu.org/archive/html/bug-readline/2015-05/msg00016.html Hopefully, Chet will apply it.