https://bugs.freedesktop.org/show_bug.cgi?id=76260

Michael Meeks <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]
            Summary|FILEOPEN: very slow loading |FILEOPEN: extremely slow
                   |119 pages .docx             |loading .docx with lots of
                   |                            |footnotes

--- Comment #27 from Michael Meeks <[email protected]> ---
Hah - so, all this useful micro-optimisation later; it turns out that the
problem is quite simple; here am I trying to make parsing more efficient (and
there is a load of dead-wood there) - but I get only 10%+ at a time ;-)

It turns out that 367bn cycles of 376bn (ie. all of it) are in children of:

OOXMLFastContextHandler::resolveFootnote

which is called 973 times here (on a 700kb XML file). I rather suspect that we
are parsing that same file in its entirety repeatedly to no good purpose ;-)
surely we have to be doing something almost as silly to be -this- slow for what
is (after all) not the world's largest DOCX file.

Then again, callgrind could be lying to me - but ... the stack seems to suggest
that we create a sub-stream and launch a new fastparser for it each time we hit
a footnote here.

#1  0xac603a41 in writerfilter::ooxml::OOXMLDocumentImpl::resolve
(this=0x88678d8, rStream=...)
    at
/data/opt/libreoffice/master/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx:502
#2  0xac59b428 in writerfilter::dmapper::DomainMapper_Impl::substream
(this=0x87a9128, rName=90016, ref=
  boost::shared_ptr {_vptr.Reference = 0xac72f3e0 <vtable for
writerfilter::ooxml::OOXMLDocumentImpl+8>})
    at
/data/opt/libreoffice/master/writerfilter/source/dmapper/DomainMapper.cxx:3003
#3  0xac638336 in writerfilter::LoggedStream::substream (this=0x87a9ae4,
name=90016, ref=
  boost::shared_ptr {_vptr.Reference = 0xac72f3e0 <vtable for
writerfilter::ooxml::OOXMLDocumentImpl+8>})
    at
/data/opt/libreoffice/master/writerfilter/source/resourcemodel/LoggedResources.cxx:253
#4  0xac6004d3 in
writerfilter::ooxml::OOXMLDocumentImpl::resolveFastSubStreamWithId
(this=0x87b1cd0, rStream=..., pStream=
  boost::shared_ptr {_vptr.Reference = 0xac72f3e0 <vtable for
writerfilter::ooxml::OOXMLDocumentImpl+8>}, nId=90016)
    at
/data/opt/libreoffice/master/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx:123
#5  0xac60244c in writerfilter::ooxml::OOXMLDocumentImpl::resolveFootnote
(this=0x87b1cd0, rStream=..., rType=@0xbfffd2fc: 0, nNoteId=13)
    at
/data/opt/libreoffice/master/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx:311
#6  0xac608e7b in writerfilter::ooxml::OOXMLFastContextHandler::resolveFootnote
(this=0xaaf93328, nId=13)
    at
/data/opt/libreoffice/master/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:895
#7  0xac5fecdb in writerfilter::ooxml::OOXMLFootnoteHandler::attribute
(this=0xbfffd3d8, name=92906, val=...)
    at /data/opt/libreoffice/master/writerfilter/source/ooxml/Handler.cxx:44
#8  0xac633b8c in writerfilter::ooxml::OOXMLPropertyImpl::resolve
(this=0x8860998, rProperties=...)
    at
/data/opt/libreoffice/master/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx:168
#9  0xac633196 in writerfilter::ooxml::OOXMLPropertySetImpl::resolve
(this=0x8840de8, rHandler=...)
    at
/data/opt/libreoffice/master/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx:425
#10 0xac60e023 in
writerfilter::ooxml::OOXMLFastContextHandlerProperties::handleXNotes
(this=0xaaf93328)
    at
/data/opt/libreoffice/master/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:1141
#11 0xac6c5087 in writerfilter::ooxml::OOXMLFactory_wml::endAction
(this=0x87d76a0, pHandler=0xaaf93328)
    at
/data/opt/libreoffice/master/workdir/CustomTarget/writerfilter/source/ooxml/OOXMLFactory_wml.cxx:4840
#12 0xac60551f in writerfilter::ooxml::OOXMLFactory::endAction (this=0x87d26a8,
pHandler=0xaaf93328)
    at
/data/opt/libreoffice/master/writerfilter/source/ooxml/OOXMLFactory.cxx:262
#13 0xac6084c2 in writerfilter::ooxml::OOXMLFastContextHandler::endAction
(this=0xaaf93328, Element=2165030)
    at
/data/opt/libreoffice/master/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:376
#14 0xac60af5c in
writerfilter::ooxml::OOXMLFastContextHandlerProperties::lcl_endFastElement
(this=0xaaf93328, Element=2165030)
    at
/data/opt/libreoffice/master/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:1070
#15 0xac607fce in writerfilter::ooxml::OOXMLFastContextHandler::endFastElement
(this=0xaaf93328, Element=2165030)
    at
/data/opt/libreoffice/master/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:249
#16 0xad89e640 in (anonymous namespace)::Entity::endElement (this=0x87b3ff8)
    at /data/opt/libreoffice/master/sax/source/fastparser/fastparser.cxx:487
#17 0xad8a9206 in doContent (parser=parser@entry=0x88347d0,
startTagLevel=startTagLevel@entry=0, enc=0xad8c6d9c <utf8_encoding>,

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to