0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

updated for version 7.3.455

Problem:    Using many continuation lines can be slow.
Solution:   Adjust the reallocation size to the current length.
This commit is contained in:
Bram Moolenaar
2012-02-22 18:29:33 +01:00
parent 7282bc3e7e
commit b549a731fb
2 changed files with 12 additions and 1 deletions

View File

@@ -3448,7 +3448,7 @@ getsourceline(c, cookie, indent)
{ {
garray_T ga; garray_T ga;
ga_init2(&ga, (int)sizeof(char_u), 200); ga_init2(&ga, (int)sizeof(char_u), 400);
ga_concat(&ga, line); ga_concat(&ga, line);
ga_concat(&ga, p + 1); ga_concat(&ga, p + 1);
for (;;) for (;;)
@@ -3460,6 +3460,15 @@ getsourceline(c, cookie, indent)
p = skipwhite(sp->nextline); p = skipwhite(sp->nextline);
if (*p != '\\') if (*p != '\\')
break; break;
/* Adjust the growsize to the current length to speed up
* concatenating many lines. */
if (ga.ga_len > 400)
{
if (ga.ga_len > 8000)
ga.ga_growsize = 8000;
else
ga.ga_growsize = ga.ga_len;
}
ga_concat(&ga, p + 1); ga_concat(&ga, p + 1);
} }
ga_append(&ga, NUL); ga_append(&ga, NUL);

View File

@@ -714,6 +714,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
455,
/**/ /**/
454, 454,
/**/ /**/