Mercurial > vim
changeset 3378:e6392f2aed4c v7.3.455
updated for version 7.3.455
Problem: Using many continuation lines can be slow.
Solution: Adjust the reallocation size to the current length.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 22 Feb 2012 18:29:33 +0100 |
parents | 93a2ac06bdff |
children | 4a7a394e7afe |
files | src/ex_cmds2.c src/version.c |
diffstat | 2 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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);