summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-09-14 11:31:19 +0200
committerJan Holesovsky <kendy@collabora.com>2019-10-09 16:37:32 +0200
commitd2bc7fa9b35ef2a00ab4ebb2264c5fbc519ab6ea (patch)
treee756fb693a095ae3291f98a0cf3f2c37292588e6
parent63521cbc0b86d2d33b55860b477f596f35026d4d (diff)
shave 10% off load time of large docx file
Change-Id: I5aacde7b6886bf47e79d055639e1b911da3be168 Reviewed-on: https://gerrit.libreoffice.org/78900 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit 096b91ee15e2686d4eb7118fdb9688ba9dbc44b2) Reviewed-on: https://gerrit.libreoffice.org/78901 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com> (cherry picked from commit 4659671f3c696a27139a4df98dc0894548169ace) Reviewed-on: https://gerrit.libreoffice.org/80504 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--include/sax/fastattribs.hxx5
-rw-r--r--sax/source/fastparser/fastparser.cxx1
2 files changed, 6 insertions, 0 deletions
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 1f343a7235b9..9221c19fc376 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -78,6 +78,11 @@ public:
virtual ~FastAttributeList() override;
void clear();
+ void reserve( sal_Int32 nNumTokens )
+ {
+ maAttributeValues.reserve(nNumTokens+1);
+ maAttributeTokens.reserve(nNumTokens);
+ }
void add( sal_Int32 nToken, const sal_Char* pValue );
void add( sal_Int32 nToken, const sal_Char* pValue, size_t nValueLength );
void add( sal_Int32 nToken, const OString& rValue );
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 9959489eed3f..d2912be171f5 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -1182,6 +1182,7 @@ void FastSaxParserImpl::callbackStartElement(const xmlChar *localName , const xm
if ( rEntity.mxTokenHandler.is() )
{
// #158414# second: fill attribute list with other attributes
+ rEvent.mxAttributes->reserve( numAttributes );
for (int i = 0; i < numAttributes * 5; i += 5)
{
// attributes[] is ( localname / prefix / nsURI / valueBegin / valueEnd )