yi-editor / yi

The Haskell-Scriptable Editor
GNU General Public License v2.0
1.51k stars 201 forks source link

Slow "Paste" speed on OS X / Terminal (at least) #601

Closed oderwat closed 10 years ago

oderwat commented 10 years ago

I noticed that doing a paste from the system clipboard into YI (vim insert mode) running inside an OSX Terminal Windows is extremely slow ... as in horrible extremely slow.

Is there something I do wrong or could do better?

Fuuzetsu commented 10 years ago

I don't think there's anything you could do directly to improve situation. You could try different terminals to see whether that changes anything. You could also try the pango frontend.

The absolutely most useful information here would be if you had profiling information for us.

If you're not compiling with -O2 then you should.

If it's Yi itself that's slow, this will probably improve when https://github.com/Fuuzetsu/yi/commits/rope-integration is finished, probably few more days. I think @ethercrow is working on refactoring Vty frontend which might end up helping but I don't think he's going for perfomance.

ethercrow commented 10 years ago

2014-09-16-031453_1687x322_scrot

Actually, I'm profiling slow pasting right now. Looks like input handling in vty library is to blame. Something there is quadratic in length of input characters, when I paste two times more text, this blue bar in thread 5 becomes about four times longer.

The left half of the diagram shows me typing ":set paste", then it hangs for some time and then rapidly shows all the pasted text.

oderwat commented 10 years ago

Sorry when I am a bit useless. if you would know how hard it is to get me into Haskell after >20 years of imperative programming you would probably laugh hard. I try to be more helpful eventually.

ghost commented 10 years ago

I always thought Yi was incapable of copying from the system clipboard. I would be happy if you guys can prove me wrong. In vty, I ended up using <Shift><C-v> in insert mode to paste (and that's slow, as mentioned). In pango, even that's not possible. I never had any success pasting content from the system clipboard using vim's p or emacs' C-y.

ethercrow commented 10 years ago

/cc @coreyoconnor

coreyoconnor commented 10 years ago

Without so much as looking at more profiling data I bet the cause is this function:

That function was largely written before my time and was a bit of a mystery. I'm pretty sure the commentary and tests required to assure any changes to that function do not cause regressions are now complete. All that remains is replacing it with something not so slow that still works. Unfortunately, not something I have time for anytime soon. :-\

For now I can only file a bug: https://github.com/coreyoconnor/vty/issues/56

ethercrow commented 10 years ago

@oderwat try building vty-refactoring branch with vty-5.2.3, it has some performance improvements.

ethercrow commented 10 years ago

Performance improvements are now in master.