Skip to content

Commit

Permalink
Fix a severe performance regression on filtering add-ons
Browse files Browse the repository at this point in the history
For some reason, it only occurred in debug builds when I tested.

The problem was that partial relayout didn't respect
invalidate_layout_blocker. As a result, in situations such as populating a
listbox one entry at a time, the layout system ended up performing dozens
of full relayouts that, not surprisingly, is extremely expensive.

Regression from commit 01035f0.
  • Loading branch information
jyrkive committed Apr 8, 2017
1 parent 76dcfcb commit fb3cae6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/gui/widgets/grid.cpp
Expand Up @@ -385,6 +385,11 @@ void grid::demand_reduce_height(const unsigned /*maximum_height*/)

void grid::request_placement(dispatcher&, const event::ui_event, bool& handled, bool&)
{
if (get_window()->invalidate_layout_blocked()) {
handled = true;
return;
}

point size = get_size();
point best_size = calculate_best_size();
if(size.x >= best_size.x && size.y >= best_size.y) {
Expand Down
8 changes: 7 additions & 1 deletion src/gui/widgets/window.hpp
Expand Up @@ -256,6 +256,12 @@ class window : public panel, public cursor::setter
window& window_;
};

/** Is invalidate_layout blocked, see invalidate_layout_blocker. */
bool invalidate_layout_blocked() const
{
return invalidate_layout_blocked_;
}

/**
* Updates the size of the window.
*
Expand Down Expand Up @@ -521,7 +527,7 @@ class window : public panel, public cursor::setter
/** The variables of the canvas. */
wfl::map_formula_callable variables_;

/** Is invalidate layout blocked see invalidate_layout_blocker. */
/** Is invalidate_layout blocked, see invalidate_layout_blocker. */
bool invalidate_layout_blocked_;

/** Avoid drawing the window. */
Expand Down

0 comments on commit fb3cae6

Please sign in to comment.