[Libreoffice-commits] core.git: include/sax sax/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sat Sep 14 13:30:47 UTC 2019
include/sax/fastattribs.hxx | 5 +++++
sax/source/fastparser/fastparser.cxx | 1 +
2 files changed, 6 insertions(+)
New commits:
commit 096b91ee15e2686d4eb7118fdb9688ba9dbc44b2
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Sep 14 11:31:19 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Sep 14 15:30:00 2019 +0200
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 at collabora.co.uk>
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 10ca8a2fad1f..ddbc0a5c1e2f 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 517f16f7c14a..3a8bbcfb9a62 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -1164,6 +1164,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 )
More information about the Libreoffice-commits
mailing list