Kaydet (Commit) c40a0d8c authored tarafından Noel Grandin's avatar Noel Grandin

tdf#117066 Saving ODT document with ~1500 bookmarks is slow, part 3

Individually, these don't make much difference, but they add up
to a halving the time to save on my machine.

ManifestImport::characters was spending time adding data to an OUString,
so convert that to an OUStringBuffer.

Change-Id: I267e701f4e7998044763f44199b1fe8a37325b68
Reviewed-on: https://gerrit.libreoffice.org/70311
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst a1bba53d
...@@ -173,7 +173,7 @@ void ManifestImport::doEncryptedCipherValue() ...@@ -173,7 +173,7 @@ void ManifestImport::doEncryptedCipherValue()
{ {
aKeyInfoSequence[2].Name = "CipherValue"; aKeyInfoSequence[2].Name = "CipherValue";
uno::Sequence < sal_Int8 > aDecodeBuffer; uno::Sequence < sal_Int8 > aDecodeBuffer;
::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters); ::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters.toString());
aKeyInfoSequence[2].Value <<= aDecodeBuffer; aKeyInfoSequence[2].Value <<= aDecodeBuffer;
aCurrentCharacters = ""; // consumed aCurrentCharacters = ""; // consumed
} }
...@@ -187,7 +187,7 @@ void ManifestImport::doEncryptedKeyId() ...@@ -187,7 +187,7 @@ void ManifestImport::doEncryptedKeyId()
{ {
aKeyInfoSequence[0].Name = "KeyId"; aKeyInfoSequence[0].Name = "KeyId";
uno::Sequence < sal_Int8 > aDecodeBuffer; uno::Sequence < sal_Int8 > aDecodeBuffer;
::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters); ::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters.toString());
aKeyInfoSequence[0].Value <<= aDecodeBuffer; aKeyInfoSequence[0].Value <<= aDecodeBuffer;
aCurrentCharacters = ""; // consumed aCurrentCharacters = ""; // consumed
} }
...@@ -201,7 +201,7 @@ void ManifestImport::doEncryptedKeyPacket() ...@@ -201,7 +201,7 @@ void ManifestImport::doEncryptedKeyPacket()
{ {
aKeyInfoSequence[1].Name = "KeyPacket"; aKeyInfoSequence[1].Name = "KeyPacket";
uno::Sequence < sal_Int8 > aDecodeBuffer; uno::Sequence < sal_Int8 > aDecodeBuffer;
::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters); ::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters.toString());
aKeyInfoSequence[1].Value <<= aDecodeBuffer; aKeyInfoSequence[1].Value <<= aDecodeBuffer;
aCurrentCharacters = ""; // consumed aCurrentCharacters = ""; // consumed
} }
...@@ -510,7 +510,7 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName ) ...@@ -510,7 +510,7 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName )
void SAL_CALL ManifestImport::characters( const OUString& aChars ) void SAL_CALL ManifestImport::characters( const OUString& aChars )
{ {
aCurrentCharacters += aChars; aCurrentCharacters.append(aChars);
} }
void SAL_CALL ManifestImport::ignorableWhitespace( const OUString& /*aWhitespaces*/ ) void SAL_CALL ManifestImport::ignorableWhitespace( const OUString& /*aWhitespaces*/ )
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <com/sun/star/xml/sax/XDocumentHandler.hpp> #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/beans/NamedValue.hpp>
#include <vector> #include <vector>
#include <rtl/ustrbuf.hxx>
#include <HashMaps.hxx> #include <HashMaps.hxx>
...@@ -54,7 +55,7 @@ class ManifestImport final : public cppu::WeakImplHelper < css::xml::sax::XDocum ...@@ -54,7 +55,7 @@ class ManifestImport final : public cppu::WeakImplHelper < css::xml::sax::XDocum
std::vector< css::beans::NamedValue > aKeyInfoSequence; std::vector< css::beans::NamedValue > aKeyInfoSequence;
std::vector< css::uno::Sequence< css::beans::NamedValue > > aKeys; std::vector< css::uno::Sequence< css::beans::NamedValue > > aKeys;
std::vector< css::beans::PropertyValue > aSequence; std::vector< css::beans::PropertyValue > aSequence;
OUString aCurrentCharacters; OUStringBuffer aCurrentCharacters;
ManifestStack aStack; ManifestStack aStack;
bool bIgnoreEncryptData; bool bIgnoreEncryptData;
bool bPgpEncryption; bool bPgpEncryption;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment