Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document.add(PdfPTable) is very slow in versions 1.3.32 and higher #1017

Closed
zinntech opened this issue Jan 7, 2024 · 11 comments
Closed

Document.add(PdfPTable) is very slow in versions 1.3.32 and higher #1017

zinntech opened this issue Jan 7, 2024 · 11 comments
Labels

Comments

@zinntech
Copy link

zinntech commented Jan 7, 2024

Describe the bug
Document.add(PdfPTable) is very slow in versions 1.3.32 and higher
When creating a table with 10,000 rows versions 1.3.32 takes 90,000 ms
In previous versions, this would take less than 200 ms.

To Reproduce
Attached is a simple program to reproduce the issue.
slowPdfTableDemo.zip

To run it:
mvn clean package
cd target
java -jar slowPdfTableDemo-1.0-SNAPSHOT.jar

Expected behavior
In previous versions, this code would run in about 280ms.

Screenshots
None

System (please complete the following information):

  • OS: Windows 11
  • Used Font: Default

Additional context

@zinntech zinntech added the bug label Jan 7, 2024
@andreasrosdal

This comment was marked as outdated.

@fellmann
Copy link
Contributor

fellmann commented Jan 8, 2024

Hi, unfortunately I can confirm this change causes the performance drop. This is because the redistribution of row height is not calculated once per row, but at least x^2. I will try find to a simple fix.

@andreasrosdal

This comment was marked as outdated.

@andreasrosdal

This comment was marked as outdated.

@fellmann
Copy link
Contributor

fellmann commented Jan 8, 2024

I will provide a fix today.

@fellmann
Copy link
Contributor

fellmann commented Jan 8, 2024

@andreasrosdal This fix should resolve the performance problem.While testing I found another problem concerning missing lines when a row continues after a page wrap. I will create a separate ticket for it, as I believe it is not related this bug.

@andreasrosdal
Copy link
Contributor

Thank you, I have verified that the performance issue is solved now.
Please create a separate ticket for the problem concerning missing lines when a row continues after a page wrap.

@andreasrosdal
Copy link
Contributor

I plan on making a new release of OpenPDF tomorrow with this fix included.

@fellmann
Copy link
Contributor

fellmann commented Jan 9, 2024

@andreasrosdal Created #1021

@zinntech
Copy link
Author

zinntech commented Jan 10, 2024

I just finished testing our product this morning with the 1.3.36 release and it is working great.

I certainly did not expect this issue to be analyzed, fixed and a new version released in less than 24 hours of posting this bug.

Thank you for the fast resolution of this issue, it is much appreciated by me and my team.

@andreasrosdal
Copy link
Contributor

You are welcome. Now I have updated the latest master branch of OpenPDF to require Java 11. This is part of modernizing OpenPDF to work in Java 11+. It would be helpful if you could please test this development branch and see if OpenPDF works correctly in Java 11 for you. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants