pyfpdf
pyfpdf copied to clipboard
Making FPDF.output() x100 time faster by using a bytearray buffer
There is a detailed article explaining why this is faster: https://www.guyrutenberg.com/2020/04/04/fast-bytes-concatenation-in-python/
On a document I'm working on with over 12 000 pages, thanks to this patch the output generation passed from taking 20 minutes to 2 seconds.
I added a commit that also improves the performances of internal calls to ._out()
(_e.g. inside FPDF.image()
),
using the same approach.
This new commit also introduces DEBUG logs indicating the sizes of the final doc sections.
Can confirm that this works wonders, master version did not finish within 20 minutes for 1040 pages of images, this did it in 5 seconds. Cheers! Hope it gets added soon.
I dont think anyone is adding things to this project, but i just released a new version of my fork of it due to a request to support python3.9.
On Tue, Oct 27, 2020 at 12:08 PM Thomas Konings [email protected] wrote:
Can confirm that this works wonders, master version did not finish within 20 minutes for 1040 pages of images, this did it in 5 seconds. Cheers! Hope it gets added soon.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/reingart/pyfpdf/pull/164#issuecomment-717350323, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACECGJE5UOMHSLTAA5AX3B3SM3V6FANCNFSM4QLS43AQ .
I was planning to release a pyfpdf2
lib on Pypi before the end of the year, but I realize someone has already done that ! :D
@alexanderankin, do you think other commits from my fork could be merged into yours ? cf. https://github.com/Lucas-C/pyfpdf#pyfpdf-fpdf-for-python
I'd be willing to contribute to a maintained fork of pyfpdf
:)
i doubt it but i can take a serious within this week. the very first commit i did was style, so a clean rebase is not likely.
On Tue, Oct 27, 2020 at 4:47 PM Lucas Cimon [email protected] wrote:
I was planning to release a pyfpdf2 lib on Pypi before the end of the year, but I realize someone has already done that ! :D
@alexanderankin https://github.com/alexanderankin, do you think other commits from my fork could be merged into yours ? cf. https://github.com/Lucas-C/pyfpdf#pyfpdf-fpdf-for-python
I'd be willing to contribute to a maintained fork of pyfpdf :)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/reingart/pyfpdf/pull/164#issuecomment-717529359, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACECGJGZ7PBW4QM5DGX544TSM4WXBANCNFSM4QLS43AQ .
This was ported to fpdf2
: https://github.com/alexanderankin/pyfpdf/blob/master/CHANGELOG.md#210---2020-12-07