sax/source/fastparser/fastparser.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
New commits: commit 786d0b9abf76b2f84d333e18c902a374ab3b3090 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Jun 15 09:26:24 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Jun 15 15:57:48 2020 +0200 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.gran...@collabora.co.uk> diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 49648fe626b2..a10ccdbcae24 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits