From 7328d48e5920bd3e083eb26a70f016398b005ca3 Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Thu, 9 Nov 2017 02:35:18 +0000 Subject: [PATCH] Ref T184 Optimization: getSelectedDockInfoArea iterates over all info areas in linear O(n) time. There is no need to do this in isSelectedDockWidgetInfoArea, as it can be checked in constant O(1) time. This method was occupying a significant proportion of the CPU time of swift. --- src/blackgui/infoarea.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/blackgui/infoarea.cpp b/src/blackgui/infoarea.cpp index c12bac697..3c5772495 100644 --- a/src/blackgui/infoarea.cpp +++ b/src/blackgui/infoarea.cpp @@ -169,7 +169,9 @@ namespace BlackGui { if (!infoArea) { return false; } if (infoArea->isFloating()) { return false; } - return infoArea == this->getSelectedDockInfoArea(); + if (!infoArea->isWidgetVisible()) { return false; } + if (!m_tabBar || m_tabBar->count() < 1) { return false; } + return true; } const CDockWidgetInfoArea *CInfoArea::getSelectedDockInfoArea() const