2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 02:49:00 +00:00

Performance fix on preserveObjectStreams

This commit is contained in:
Jay Berkenbilt 2021-05-09 07:51:14 -04:00
parent bddebdb0ea
commit 3cacb27a90
2 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2021-05-09 Jay Berkenbilt <ejb@ql.org>
* Improve performance of preservation of object streams by
avoiding unnecessary traversal of objects when there are no object
streams.
2021-05-08 Jay Berkenbilt <ejb@ql.org>
* 10.3.2: release

View File

@ -2361,6 +2361,12 @@ QPDFWriter::initializeSpecialStreams()
void
QPDFWriter::preserveObjectStreams()
{
std::map<int, int> omap;
QPDF::Writer::getObjectStreamData(this->m->pdf, omap);
if (omap.empty())
{
return;
}
// Our object_to_object_stream map has to map ObjGen -> ObjGen
// since we may be generating object streams out of old objects
// that have generation numbers greater than zero. However in an
@ -2380,8 +2386,6 @@ QPDFWriter::preserveObjectStreams()
}
QTC::TC("qpdf", "QPDFWriter preserve object streams",
this->m->preserve_unreferenced_objects ? 0 : 1);
std::map<int, int> omap;
QPDF::Writer::getObjectStreamData(this->m->pdf, omap);
for (auto iter: omap)
{
QPDFObjGen og(iter.first, 0);