[ 
https://issues.apache.org/jira/browse/PDFBOX-5846?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

liu updated PDFBOX-5846:
------------------------
    Summary: A PDF with 5.3 million xref data, performance comparison between 
pdfbox3 and itextpdf.hope to optimize the memory usage and loading process 
time.  (was: A PDF with 5.3 million xref data, performance comparison between 
pdfbox3 and itextpdf.)

> A PDF with 5.3 million xref data, performance comparison between pdfbox3 and 
> itextpdf.hope to optimize the memory usage and loading process time.
> -------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-5846
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5846
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Rendering
>    Affects Versions: 3.0.2 PDFBox
>            Reporter: liu
>            Priority: Major
>         Attachments: 66.7z, image-2024-06-28-15-49-33-885.png, 
> image-2024-06-28-15-50-36-240.png, image-2024-06-28-15-57-49-634.png, 
> image-2024-06-28-16-00-39-424.png
>
>
> There is a pdf in this compressed file.
> [^66.zip]
>  
> Test comparison code
>  
> {code:java}
> //代码占位符
> package net.qiyuesuo.common.pdf;
> import com.itextpdf.text.pdf.PdfReader;
> import org.apache.pdfbox.Loader;
> import org.apache.pdfbox.io.IOUtils;
> import org.apache.pdfbox.pdmodel.PDDocument;
> import java.io.File;
> /**
>  * @author :      
>  * @description :
>  * @date :        
>  */
> public class Test6 {
>    private static void pdfbox3() throws Throwable{
>       long l = System.currentTimeMillis();
>       File file = new File("C:\\Users\\LYCIT\\Downloads\\66.pdf");
>       PDDocument pdf = Loader.loadPDF(file, 
> IOUtils.createTempFileOnlyStreamCache());
>       System.out.println("loadPDF time:"+ (System.currentTimeMillis() - l));
>       Thread.sleep(36000000);
>    }
>    public static void itextpdf() throws Throwable {
>       long l = System.currentTimeMillis();
>       String file = "C:\\Users\\LYCIT\\Downloads\\66.pdf";
>       final PdfReader pdfReader = new PdfReader(file, null, true);
>       System.out.println("loadPDF time:"+ (System.currentTimeMillis() - l));
>       Thread.sleep(36000000);
>    }
>    public static void main(String[] args) throws Throwable {
>       pdfbox3();
> //    itextpdf();
>    }
> }
>  {code}
> Load time:
> pdfbox3:10233 ms.
>  
> itextpdf:925 ms.
> Memory usage:
> pdfbox3:790M.
> !image-2024-06-28-15-49-33-885.png|width=312,height=151!
> itextpdf:106M.
> !image-2024-06-28-15-50-36-240.png|width=307,height=166!
>  
> Detailed memory usage:
> pdfbox3:xrefTable and keyCache.
> !image-2024-06-28-15-57-49-634.png|width=307,height=200!
> itextpdf:xref and xrefObj.
> !image-2024-06-28-16-00-39-424.png|width=311,height=203!
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to