From 3d6628f084e59f7e8947d9dcb33b28711de59bcf Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 25 Sep 2021 19:22:59 +0200 Subject: [PATCH] Massive ~2500% speed improvement for OptionListComponent. --- es-core/src/components/MenuComponent.h | 5 +++-- es-core/src/components/OptionListComponent.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/es-core/src/components/MenuComponent.h b/es-core/src/components/MenuComponent.h index c9c1dc1ba..2604ca837 100644 --- a/es-core/src/components/MenuComponent.h +++ b/es-core/src/components/MenuComponent.h @@ -39,10 +39,11 @@ public: void setNeedsSaving() { mNeedsSaving = true; } - void addRow(const ComponentListRow& row, bool setCursorHere = false) + void addRow(const ComponentListRow& row, bool setCursorHere = false, bool updateRowSize = true) { mList->addRow(row, setCursorHere); - updateSize(); + if (updateRowSize) + updateSize(); } void addWithLabel(const std::string& label, diff --git a/es-core/src/components/OptionListComponent.h b/es-core/src/components/OptionListComponent.h index 84fdf9236..25df35e61 100644 --- a/es-core/src/components/OptionListComponent.h +++ b/es-core/src/components/OptionListComponent.h @@ -409,7 +409,7 @@ private: } // Also set cursor to this row if we're not multi-select and this row is selected. - mMenu.addRow(row, (!mParent->mMultiSelect && it->selected)); + mMenu.addRow(row, (!mParent->mMultiSelect && it->selected), false); } mMenu.addButton("BACK", "back", [this] { delete this; });