Apache OpenOffice (AOO) Bugzilla – Issue 100177
performance: impl_ts_getLocale result should be reused
Last modified: 2009-05-08 10:04:55 UTC
While debugging into issue 98052 and issue 100172 it showed that the method impl_ts_getLocale() is reponsible for almost half of the multi-second wait because the underlying configmgr is so slow. The header file comments that > We does not cache this value, because we are not listen for changes on the configuration layer ... but it is easily possible to reduce the 140 expensive invokations to 4 without loosing anything by moving the expensive call outside the inner loop in impl_ts_load(). On this dualcore 2GHz system the patch below saves more than a second: --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -1247,2 +1245,3 @@ css::uno::Sequence< ::rtl::OUString > lKeys = xAccess->getElementNames(); + const ::rtl::OUString sLocale = impl_ts_getLocale().toISO(); sal_Int32 nKeys = lKeys.getLength(); @@ -1264,1 +1262,1 @@ - if ( *pFound == impl_ts_getLocale().toISO() ) + if ( *pFound == sLocale )
s/sLocale/sCfgLocale/
+me on CC @hdu : I have tested this patch (with DEV300_m43) + the other patch found at issue 100172 : the change is really visible. thanks a lot !!
.
@ericb: thanks for testing the fix. The problem really proves that one should never trust explanations for performance issues unless they have been analyzed. The two performance bugs mentioned were responsible for much more of the UI-delay than the real work (loading the spell-checker, hyphenator, grammar checker and keyboard shortcuts).
cd->hdu: We discussed by phone with as that moving the line out of the loop is an easy fix with is NOT dangerous. cd: Therefore approved by me and as.
cd: Add regression keyword. Ok in OOo 3.0.1.
cd: Started.
cd: Set correct target. Approved as show stopper.
code change reviewed => ok Copying the locales into the vector seems like a waste of time too. Compared to the improvements by the current fix it is only a minor issue though.
cd: Fixed.
cd->sba: Please verify.
Verified in CWS fwk106.
OK in OOO310_m11 (OOo 3.1). Closed.