From 75adf8368a649b62bfa4a20e8c21340cf53c2a6a Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 3 Feb 2017 20:53:03 +0000 Subject: [PATCH] Expand lines more aggressively to reduce rate of allocations. --- grid.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/grid.c b/grid.c index dbb4fe64..f1dc130b 100644 --- a/grid.c +++ b/grid.c @@ -292,6 +292,12 @@ grid_expand_line(struct grid *gd, u_int py, u_int sx, u_int bg) if (sx <= gl->cellsize) return; + if (sx < gd->sx) { + sx *= 2; + if (sx > gd->sx) + sx = gd->sx; + } + gl->celldata = xreallocarray(gl->celldata, sx, sizeof *gl->celldata); for (xx = gl->cellsize; xx < sx; xx++) grid_clear_cell(gd, xx, py, bg);