Hi Jonathan!

Great patch! I commited it to SVN immediately. I think we should look for
more cases where insert_sorted can be used instead of push_back!

Thanks again!

Regards,
   Dominik

On Sun, Apr 24, 2011 at 9:07 PM, Jonathan Verner
<[email protected]>wrote:

> Hello,
>
> when trying to use PoDoFo to parse large files (e.g. the PDF spec),
> PdfMemDocument took forever to load. When I tried running, e.g.
> podofocountpages on the PDF spec after approx. ten minutes it wasn't
> finished yet.
>
> After looking at it, I found out that most of the time
> is spent in
>
>   PdfObjectStreamparserObject::ReadObjectsFromStream
>
> in the while cycle.
>
> First, on line 98 (PdfObjectStreamParserObject.cpp)
> GetObject is called. If the m_vecObjects vector is not sorted, the
> method first calls sort to sort it.
> Then, on line 102, a new object is pushed_back into the vector,
> which invalidates the sorting so when GetObject is called again,
> it has to sort the list again --- Quite time consuming.
>
> I have tried replacing the push_back on line 102 by a new
> method insert_sorted, which inserts the element into
> the vector so that it stays sorted (if it was sorted in the first place)
> and this has led to a dramatic improvement: now podofocountpages
> finishes in a reasonable amount of time:
>
> $ time podofocountpages PDF32000_2008.pdf
> PDF32000_2008.pdf:      756
>
> real    0m20.235s
> user    0m16.809s
> sys     0m0.260s
>
>
> Attached is my proposed patch. What do you think about it?
>
> Best,
>
> Jonathan Verner
>
> ------------------------------------------------------------------------------
> Fulfilling the Lean Software Promise
> Lean software platforms are now widely adopted and the benefits have been
> demonstrated beyond question. Learn why your peers are replacing JEE
> containers with lightweight application servers - and what you can gain
> from the move. http://p.sf.net/sfu/vmware-sfemails
> _______________________________________________
> Podofo-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/podofo-users
>
>
------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been 
demonstrated beyond question. Learn why your peers are replacing JEE 
containers with lightweight application servers - and what you can gain 
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to