diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-15 09:26:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-15 15:57:48 +0200 |
commit | 786d0b9abf76b2f84d333e18c902a374ab3b3090 (patch) | |
tree | f30648113d0fe401ebdb41841f72818e55a4b052 /sax | |
parent | b314735568c1e9ab8ca52413017425bc2ef12973 (diff) |
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>
Diffstat (limited to 'sax')
-rw-r--r-- | sax/source/fastparser/fastparser.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
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 |