Hi

I've noticed that pasting a large amount of text in the
Ex command line of Vim-7.3.444 (huge) is very slow.
Performances is quadratic with the number of characters
pasted.

Attached patch speeds it up.

Here is the measured speed to paste 1000, 2000, 4000,
8000, 16000 characters in Ex command line before and
after patch:

  number of     time        time
  characters    before      after
  pasted        patch       patch
  ------------  ---------   -------
  1000          0.195 sec   0.050 sec
  2000          0.610 sec   0.050 sec
  4000          2.363 sec   0.053 sec
  8000          8.564 sec   0.059 sec
 16000          26.960 sec  0.091 sec

I measured with this command (example with 8000 characters):

$ time vim -u NONE \
   -c 'let @"=repeat("x", 8000)|call feedkeys(":\<C-R>\"\<C-C>:q\<CR>")'

Patch is small but function getcmdline(...) is complicated
so please double check that the patch is OK. I don't see any
unwanted side effect.

Regards
-- Dominique

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff -r b37888de599c src/ex_getln.c
--- a/src/ex_getln.c	Mon Feb 13 00:05:22 2012 +0100
+++ b/src/ex_getln.c	Sun Feb 19 01:15:40 2012 +0100
@@ -1852,8 +1852,11 @@
 # endif
 		)
 	    /* Always redraw the whole command line to fix shaping and
-	     * right-left typing.  Not efficient, but it works. */
-	    redrawcmd();
+	     * right-left typing.  Not efficient, but it works.
+	     * Do it only when there are no characters left to read
+	     * to avoid useless intermediate redraws. */
+	    if (vpeekc() == NUL)
+		redrawcmd();
 #endif
     }
 

Raspunde prin e-mail lui