summaryrefslogtreecommitdiff
path: root/cppuhelper/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@collabora.co.uk>2024-05-02 10:44:45 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-05-03 09:00:41 +0200
commit5edaca5c892dbe07c0edb1ea0de4a115300e8ef0 (patch)
treeec2efb003b384e71e195aba24446c79fb8e0751c /cppuhelper/source
parentb7ba358d48c1419142f88b8121b848113969eaaf (diff)
use boost::small_vector in cppuhelper
shaves 5% off startup time Change-Id: I901e1112727eb7a50f70d1853386e0696fee7e5e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167000 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'cppuhelper/source')
-rw-r--r--cppuhelper/source/servicemanager.cxx15
-rw-r--r--cppuhelper/source/servicemanager.hxx3
2 files changed, 6 insertions, 12 deletions
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index 415d0edb0e3c..32b4976cf1e1 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -68,10 +68,7 @@ void insertImplementationMap(
assert(destination != nullptr);
for (const auto& [rName, rImpls] : source)
{
- std::vector<
- std::shared_ptr<
- cppuhelper::ServiceManager::Data::Implementation > > & impls
- = (*destination)[rName];
+ auto & impls = (*destination)[rName];
impls.insert(impls.end(), rImpls.begin(), rImpls.end());
}
}
@@ -87,13 +84,9 @@ void removeFromImplementationMap(
assert(map != nullptr);
for (const auto& rElement : elements)
{
- cppuhelper::ServiceManager::Data::ImplementationMap::iterator j(
- map->find(rElement));
+ auto j(map->find(rElement));
assert(j != map->end());
- std::vector<
- std::shared_ptr<
- cppuhelper::ServiceManager::Data::Implementation > >::iterator
- k(std::find(j->second.begin(), j->second.end(), implementation));
+ auto k(std::find(j->second.begin(), j->second.end(), implementation));
assert(k != j->second.end());
j->second.erase(k);
if (j->second.empty()) {
@@ -1139,7 +1132,7 @@ css::uno::Reference< css::container::XEnumeration >
cppuhelper::ServiceManager::createContentEnumeration(
OUString const & aServiceName)
{
- std::vector< std::shared_ptr< Data::Implementation > > impls;
+ boost::container::small_vector< std::shared_ptr< Data::Implementation >, 2 > impls;
{
std::unique_lock g(m_aMutex);
Data::ImplementationMap::const_iterator i(
diff --git a/cppuhelper/source/servicemanager.hxx b/cppuhelper/source/servicemanager.hxx
index af80be25a183..8ab144b115ee 100644
--- a/cppuhelper/source/servicemanager.hxx
+++ b/cppuhelper/source/servicemanager.hxx
@@ -32,6 +32,7 @@
#include <com/sun/star/uno/Reference.hxx>
#include <compbase2.hxx>
#include <rtl/ustring.hxx>
+#include <boost/container/small_vector.hpp>
namespace com::sun::star::lang {
class XSingleComponentFactory;
@@ -174,7 +175,7 @@ public:
typedef
std::unordered_map<
OUString,
- std::vector< std::shared_ptr< Implementation > > >
+ boost::container::small_vector< std::shared_ptr< Implementation >, 2 > >
ImplementationMap;
NamedImplementations namedImplementations;