diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-05-12 18:55:13 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-05-14 20:24:42 +0000 |
commit | 812233147c8b09b59eeb212663727a9063c7c9c6 (patch) | |
tree | e7d0a91888614a0fe6ff7c67ef321eb5e06d2b51 | |
parent | 1d2091b91e91b50eb98f41c7659746a47cb70c73 (diff) |
tdf#99722 sw: silly performance issue when firing a11y events
SwAccessibleEventList_Impl::MoveInvalidXAccToEnd() pointlessly copies every
single element when iterating over the list and then deletes the copy again
(which is expensive due to the WeakReference member).
This speeds up loading the first 500 pages of the bugdoc from 4:20 to
1:37 in a Linux dbgutil build.
(regression from 76c549eb01dcb7b5bf28a271ce00e386f3d388ba)
Change-Id: I7c7299e5e82095f5a51f395bc5076ca899b59f81
(cherry picked from commit e3b990a47fc4b0b1191eb15a53badfc71aebc1fc)
Reviewed-on: https://gerrit.libreoffice.org/24978
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/source/core/access/accmap.cxx | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 817bdfd2ebc9..8f6c9da395bf 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -526,17 +526,12 @@ void SwAccessibleEventList_Impl::MoveInvalidXAccToEnd() return; } SwAccessibleEventList_Impl lstEvent; - iterator li = begin(); - for ( ;li != end();) + for (iterator li = begin(); li != end(); ) { - SwAccessibleEvent_Impl e = *li; - if (e.IsNoXaccParentFrame()) + if (li->IsNoXaccParentFrame()) { - iterator liNext = li; - ++liNext; - erase(li); - li = liNext; - lstEvent.insert(lstEvent.end(),e); + lstEvent.insert(lstEvent.end(), *li); + li = erase(li); } else ++li; |