svl/source/numbers/numuno.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
New commits: commit 083556bd17713bbbb1e7569b738c87dc3e93edf9 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Fri Apr 4 15:38:34 2025 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Fri Apr 4 19:22:25 2025 +0200 reduce object creation in SvNumberFormatsSupplierObj (tdf#147874 related) otherwise we create and destroy a ton of these in tight loops when processing large charts. Change-Id: Id9f5ef2bd5ea3b7d068dfd62a703b3bf11a5c100 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183716 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/svl/source/numbers/numuno.cxx b/svl/source/numbers/numuno.cxx index db633f40554e..7deea0dfca6b 100644 --- a/svl/source/numbers/numuno.cxx +++ b/svl/source/numbers/numuno.cxx @@ -29,6 +29,7 @@ class SvNumFmtSuppl_Impl public: SvNumberFormatter* pFormatter; mutable ::comphelper::SharedMutex aMutex; + rtl::Reference<SvNumberFormatsObj> mxNumberFormatsObj; explicit SvNumFmtSuppl_Impl(SvNumberFormatter* p) : pFormatter(p) {} @@ -64,6 +65,7 @@ void SvNumberFormatsSupplierObj::SetNumberFormatter(SvNumberFormatter* pNew) { // The old Numberformatter has been retired, do not access it anymore! pImpl->pFormatter = pNew; + pImpl->mxNumberFormatsObj.clear(); } // XNumberFormatsSupplier @@ -79,7 +81,10 @@ uno::Reference<util::XNumberFormats> SAL_CALL SvNumberFormatsSupplierObj::getNum { ::osl::MutexGuard aGuard( pImpl->aMutex ); - return new SvNumberFormatsObj( *this, pImpl->aMutex ); + if (!pImpl->mxNumberFormatsObj) + pImpl->mxNumberFormatsObj = new SvNumberFormatsObj( *this, pImpl->aMutex ); + + return pImpl->mxNumberFormatsObj; } // XUnoTunnel