summaryrefslogtreecommitdiff
path: root/desktop/inc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-10-25 22:48:28 +0200
committerLuboš Luňák <l.lunak@collabora.com>2021-10-26 20:33:45 +0200
commitf7e6153c1bcd87a7a2f2d839c49bd7615c8dca5b (patch)
treee2f457901686a27eeff74367952e92b0056c0141 /desktop/inc
parent95cc31f15712bcd2b9829a4f9708374647af6e74 (diff)
use boost flat_map for faster map
setUpdatedTypePerViewId() gets called so often that even unordered_map lookup and allocations show up in profiling. It seems that flat_map can do better. Change-Id: Id2e4f0c40d6973b51e557f84a08bf12feb58b3ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124210 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'desktop/inc')
-rw-r--r--desktop/inc/lib/init.hxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index 01620a4f02ac..337c0f23340c 100644
--- a/desktop/inc/lib/init.hxx
+++ b/desktop/inc/lib/init.hxx
@@ -17,6 +17,7 @@
#include <boost/property_tree/ptree.hpp>
#include <boost/variant.hpp>
+#include <boost/container/flat_map.hpp>
#include <osl/thread.h>
#include <rtl/ref.hxx>
@@ -199,7 +200,8 @@ namespace desktop {
bool set; // value is if set
int sourceViewId;
};
- std::unordered_map<int, std::vector<PerViewIdData>> m_updatedTypesPerViewId; // key is view, index is type
+ // Flat_map is used in preference to unordered_map because the map is accessed very often.
+ boost::container::flat_map<int, std::vector<PerViewIdData>> m_updatedTypesPerViewId; // key is view, index is type
LibreOfficeKitDocument* m_pDocument;
int m_viewId = -1; // view id of the associated SfxViewShell