summaryrefslogtreecommitdiff
path: root/svl/source/items
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-03-27 11:02:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-27 13:26:30 +0200
commit3acc5a2383f5b0458e3caf1505fe6b8ad7dc3fb0 (patch)
tree789b5622e9775eddcfb1cc4a1f683fd162779aca /svl/source/items
parentc49b42fcc8687fafdbb9db41a58ff4f8208d0896 (diff)
tdf#69977 improve creation of large charts
this patch only tweaks a few things around the edges. The bulk of the cost is down in the chart2 module where it creates ticks and labels. Change-Id: If73a16d2f0a7511f07eff379a9b5c1b38ef96786 Reviewed-on: https://gerrit.libreoffice.org/51931 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl/source/items')
-rw-r--r--svl/source/items/itempool.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index 3abc22b96003..07eab0ab3435 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -86,14 +86,17 @@ do { \
void SfxItemPool::AddSfxItemPoolUser(SfxItemPoolUser& rNewUser)
{
- pImpl->maSfxItemPoolUsers.push_back(&rNewUser);
+ // maintain sorted to reduce cost of remove
+ const auto insertIt = ::std::lower_bound(
+ pImpl->maSfxItemPoolUsers.begin(), pImpl->maSfxItemPoolUsers.end(), &rNewUser);
+ pImpl->maSfxItemPoolUsers.insert(insertIt, &rNewUser);
}
void SfxItemPool::RemoveSfxItemPoolUser(SfxItemPoolUser& rOldUser)
{
- const std::vector<SfxItemPoolUser*>::iterator aFindResult = ::std::find(
+ const auto aFindResult = ::std::lower_bound(
pImpl->maSfxItemPoolUsers.begin(), pImpl->maSfxItemPoolUsers.end(), &rOldUser);
- if(aFindResult != pImpl->maSfxItemPoolUsers.end())
+ if(aFindResult != pImpl->maSfxItemPoolUsers.end() && *aFindResult == &rOldUser)
{
pImpl->maSfxItemPoolUsers.erase(aFindResult);
}