diff options
-rw-r--r-- | src/misc2.c | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/misc2.c b/src/misc2.c index 461d23e9f..69b9347bc 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -2057,6 +2057,13 @@ ga_grow(garray_T *gap, int n) { if (n < gap->ga_growsize) n = gap->ga_growsize; + + // A linear growth is very inefficient when the array grows big. This + // is a compromise between allocating memory that won't be used and too + // many copy operations. A factor of 1.5 seems reasonable. + if (n < gap->ga_len / 2) + n = gap->ga_len / 2; + new_len = gap->ga_itemsize * (gap->ga_len + n); pp = vim_realloc(gap->ga_data, new_len); if (pp == NULL) diff --git a/src/version.c b/src/version.c index 4b380d272..30c083107 100644 --- a/src/version.c +++ b/src/version.c @@ -768,6 +768,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1439, +/**/ 1438, /**/ 1437, |