summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-07-17 09:49:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-17 13:27:02 +0200
commitd6bd9c273483b12f1bb2ae398afdba977e3ec336 (patch)
tree982bc3a3642b7100962d07f806672754c94949d5 /sax
parentd375324a86c5cd4647da5036e846e9c648f97c9c (diff)
tdf#79878 perf loading docx file, disable SAX threading for writer
since it seems to cost us 20% performance Change-Id: Ic4796ee3756c8c722feb4851dc48a99e882ba0fe Reviewed-on: https://gerrit.libreoffice.org/57545 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sax')
-rw-r--r--sax/source/fastparser/fastparser.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 83b36d122f42..4ae2f4fdaf4a 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -247,6 +247,7 @@ public:
void parse();
void produce( bool bForceFlush = false );
bool m_bIgnoreMissingNSDecl;
+ bool m_bDisableThreadedParser;
private:
bool consume(EventList&);
@@ -634,6 +635,7 @@ namespace sax_fastparser {
FastSaxParserImpl::FastSaxParserImpl() :
m_bIgnoreMissingNSDecl(false),
+ m_bDisableThreadedParser(false),
mpTop(nullptr)
{
mxDocumentLocator.set( new FastLocatorImpl( this ) );
@@ -781,7 +783,7 @@ void FastSaxParserImpl::parseStream(const InputSource& rStructSource)
rEntity.mxDocumentHandler->startDocument();
}
- if (!getenv("SAX_DISABLE_THREADS"))
+ if (!getenv("SAX_DISABLE_THREADS") && !m_bDisableThreadedParser)
{
Reference<css::io::XSeekable> xSeekable(rEntity.maStructSource.aInputStream, UNO_QUERY);
// available() is not __really__ relevant here, but leave it in as a heuristic for non-seekable streams
@@ -1325,11 +1327,16 @@ FastSaxParser::initialize(css::uno::Sequence< css::uno::Any > const& rArguments)
if (rArguments.getLength())
{
OUString str;
- if ( ( rArguments[0] >>= str ) && "IgnoreMissingNSDecl" == str )
- mpImpl->m_bIgnoreMissingNSDecl = true;
- else if ( str == "DoSmeplease" )
+ if ( rArguments[0] >>= str )
{
- //just ignore as this is already immune to billion laughs
+ if ( str == "IgnoreMissingNSDecl" )
+ mpImpl->m_bIgnoreMissingNSDecl = true;
+ else if ( str == "DoSmeplease" )
+ ; //just ignore as this is already immune to billion laughs
+ else if ( str == "DisableThreadedParser" )
+ mpImpl->m_bDisableThreadedParser = true;
+ else
+ throw IllegalArgumentException();
}
else
throw IllegalArgumentException();