small optimisations
remove a couple of string copies in the XML parser, which is always a hot path Change-Id: I84460ce13fb197bc7a3d354ff4c39d6939ff1d7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96313 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -1227,9 +1227,12 @@ void FastSaxParserImpl::callbackStartElement(const xmlChar *localName , const xm
|
||||
nNamespaceToken = GetNamespaceToken( sNamespace );
|
||||
aElementPrefix = OUString( XML_CAST( prefix ), strlen( XML_CAST( prefix )), RTL_TEXTENCODING_UTF8 );
|
||||
}
|
||||
const OUString& rElementLocalName = OUString( XML_CAST( localName ), strlen( XML_CAST( localName )), RTL_TEXTENCODING_UTF8 );
|
||||
OUString aElementLocalName( XML_CAST( localName ), strlen( XML_CAST( localName )), RTL_TEXTENCODING_UTF8 );
|
||||
rEvent.msNamespace = sNamespace;
|
||||
rEvent.msElementName = (aElementPrefix.isEmpty())? rElementLocalName : aElementPrefix + ":" + rElementLocalName;
|
||||
if( aElementPrefix.isEmpty() )
|
||||
rEvent.msElementName = std::move(aElementLocalName);
|
||||
else
|
||||
rEvent.msElementName = aElementPrefix + ":" + aElementLocalName;
|
||||
}
|
||||
else // token is always preferred.
|
||||
rEvent.msElementName.clear();
|
||||
@@ -1305,7 +1308,7 @@ void FastSaxParserImpl::sendPendingCharacters()
|
||||
if (rEntity.mbEnableThreads)
|
||||
{
|
||||
Event& rEvent = rEntity.getEvent( CallbackType::CHARACTERS );
|
||||
rEvent.msChars = sChars;
|
||||
rEvent.msChars = std::move(sChars);
|
||||
produce();
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user