UI: Prevent button vector reallocations on redraws
A bunch of reallocations can be avoided this way, usually the amount of buttons is quite similar over redraws. Pull Request: https://projects.blender.org/blender/blender/pulls/134580
This commit is contained in:
committed by
Julian Eisel
parent
8dbd607df5
commit
f2b6b6c232
@@ -3849,6 +3849,11 @@ uiBlock *UI_block_begin(const bContext *C,
|
||||
UI_block_region_set(block, region);
|
||||
}
|
||||
|
||||
/* Prevent reallocations on redraw, most of the time blocks layout will be the same. */
|
||||
if (block->oldblock) {
|
||||
block->buttons.reserve(block->oldblock->buttons.size());
|
||||
}
|
||||
|
||||
/* Set window matrix and aspect for region and OpenGL state. */
|
||||
ui_update_window_matrix(window, region, block);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user