diff options
author | Bram Moolenaar <bram@vim.org> | 2012-02-22 18:29:33 +0100 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2012-02-22 18:29:33 +0100 |
commit | 3b5a5a66b60070adb3851091035cef70950f3962 (patch) | |
tree | 7c661420312692da80aa03ed4d7be439d6648917 | |
parent | 8aee4dfe4bf572cfddedb095ac47f014befd13f6 (diff) | |
download | vim-3b5a5a66b60070adb3851091035cef70950f3962.tar.gz |
Problem: Using many continuation lines can be slow.
Solution: Adjust the reallocation size to the current length.
-rw-r--r-- | src/ex_cmds2.c | 11 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 92cd7335..4e480eca 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -3448,7 +3448,7 @@ getsourceline(c, cookie, indent) { 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, p + 1); for (;;) @@ -3460,6 +3460,15 @@ getsourceline(c, cookie, indent) p = skipwhite(sp->nextline); if (*p != '\\') 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_append(&ga, NUL); diff --git a/src/version.c b/src/version.c index 169b9efe..7945ffee 100644 --- a/src/version.c +++ b/src/version.c @@ -715,6 +715,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 455, +/**/ 454, /**/ 453, |