qpdf: Performance regression on Windows with some PDF files

I have a PDF file where pikepdf.Pdf.open() has a 100x performance regression between version 4.0.0 and 4.1.0 using the 64-bit binary wheels: Instead of 3.5 milliseconds it takes 350 milliseconds to open the file. Not reproducible on Linux.

After I figured out that the regression happens in qpdf itself I checked out the msvc64-binaries of qpdf, here I can see the the same slowdown between the versions 10.3.2 and 10.4.0: While 10.3.2 processes the file very quickly, 10.4.0 takes more than 300 milliseconds longer. All later releases of qpdf have the same slowdown, including the most recent.

Is this a known issue?

@jberkenbilt The PDF that causes the slowdown is a file that I can’t really make public, but I’m willing to send it in private by email. So far I have found no other PDF where I could reproduce this regression. If it’s okay I could send the PDF causing the issue to you by email.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (11 by maintainers)

Commits related to this issue

Most upvoted comments

In my testing, this fix results in a 6x performance improvement with openssl 3 using 256 bit encryption (which doesn’t use rc4 at all) and a 12x improvement when rc4 is actually used. This is a great find. I have to test with openssl 1.1 before I can commit the fix. I think I may be able to slightly improve the performance for openssl 1.1 as well.