Karsten Hopp bff263
To: vim_dev@googlegroups.com
Karsten Hopp bff263
Subject: Patch 7.3.455
Karsten Hopp bff263
Fcc: outbox
Karsten Hopp bff263
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp bff263
Mime-Version: 1.0
Karsten Hopp bff263
Content-Type: text/plain; charset=UTF-8
Karsten Hopp bff263
Content-Transfer-Encoding: 8bit
Karsten Hopp bff263
------------
Karsten Hopp bff263
Karsten Hopp bff263
Patch 7.3.455
Karsten Hopp bff263
Problem:    Using many continuation lines can be slow.
Karsten Hopp bff263
Solution:   Adjust the reallocation size to the current length.
Karsten Hopp bff263
Files:	    src/ex_cmds2.c
Karsten Hopp bff263
Karsten Hopp bff263
Karsten Hopp bff263
*** ../vim-7.3.454/src/ex_cmds2.c	2012-02-11 20:40:49.000000000 +0100
Karsten Hopp bff263
--- src/ex_cmds2.c	2012-02-22 18:24:11.000000000 +0100
Karsten Hopp bff263
***************
Karsten Hopp bff263
*** 3448,3454 ****
Karsten Hopp bff263
  	{
Karsten Hopp bff263
  	    garray_T    ga;
Karsten Hopp bff263
  
Karsten Hopp bff263
! 	    ga_init2(&ga, (int)sizeof(char_u), 200);
Karsten Hopp bff263
  	    ga_concat(&ga, line);
Karsten Hopp bff263
  	    ga_concat(&ga, p + 1);
Karsten Hopp bff263
  	    for (;;)
Karsten Hopp bff263
--- 3448,3454 ----
Karsten Hopp bff263
  	{
Karsten Hopp bff263
  	    garray_T    ga;
Karsten Hopp bff263
  
Karsten Hopp bff263
! 	    ga_init2(&ga, (int)sizeof(char_u), 400);
Karsten Hopp bff263
  	    ga_concat(&ga, line);
Karsten Hopp bff263
  	    ga_concat(&ga, p + 1);
Karsten Hopp bff263
  	    for (;;)
Karsten Hopp bff263
***************
Karsten Hopp bff263
*** 3460,3465 ****
Karsten Hopp bff263
--- 3460,3474 ----
Karsten Hopp bff263
  		p = skipwhite(sp->nextline);
Karsten Hopp bff263
  		if (*p != '\\')
Karsten Hopp bff263
  		    break;
Karsten Hopp bff263
+ 		/* Adjust the growsize to the current length to speed up
Karsten Hopp bff263
+ 		 * concatenating many lines. */
Karsten Hopp bff263
+ 		if (ga.ga_len > 400)
Karsten Hopp bff263
+ 		{
Karsten Hopp bff263
+ 		    if (ga.ga_len > 8000)
Karsten Hopp bff263
+ 			ga.ga_growsize = 8000;
Karsten Hopp bff263
+ 		    else
Karsten Hopp bff263
+ 			ga.ga_growsize = ga.ga_len;
Karsten Hopp bff263
+ 		}
Karsten Hopp bff263
  		ga_concat(&ga, p + 1);
Karsten Hopp bff263
  	    }
Karsten Hopp bff263
  	    ga_append(&ga, NUL);
Karsten Hopp bff263
*** ../vim-7.3.454/src/version.c	2012-02-22 18:12:29.000000000 +0100
Karsten Hopp bff263
--- src/version.c	2012-02-22 18:24:58.000000000 +0100
Karsten Hopp bff263
***************
Karsten Hopp bff263
*** 716,717 ****
Karsten Hopp bff263
--- 716,719 ----
Karsten Hopp bff263
  {   /* Add new patch number below this line */
Karsten Hopp bff263
+ /**/
Karsten Hopp bff263
+     455,
Karsten Hopp bff263
  /**/
Karsten Hopp bff263
Karsten Hopp bff263
-- 
Karsten Hopp bff263
From "know your smileys":
Karsten Hopp bff263
 :-X	My lips are sealed
Karsten Hopp bff263
Karsten Hopp bff263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp bff263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp bff263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp bff263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///