From c13080d96c41f42ce58b063a7883cac191d6c64b Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 20 Jan 2016 18:42:30 +0000 Subject: Optimise white hot find_sides to take advantage of sorted float_children. Now we have an early exit when we get to the floats above the area we're interested in. --- render/layout.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'render') diff --git a/render/layout.c b/render/layout.c index f1e321e7f..95f3681aa 100644 --- a/render/layout.c +++ b/render/layout.c @@ -2062,8 +2062,14 @@ void find_sides(struct box *fl, int y0, int y1, *left = *right = 0; for (; fl; fl = fl->next_float) { - fy0 = fl->y; fy1 = fl->y + fl->height; + if (fy1 < y0) { + /* Floats are sorted in order of decreasing bottom pos. + * Past here, all floats will be too high to concern us. + */ + return; + } + fy0 = fl->y; if (y0 < fy1 && fy0 <= y1) { if (fl->type == BOX_FLOAT_LEFT) { fx1 = fl->x + fl->width; -- cgit v1.2.3