tecnickcom / TCPDF

Official clone of PHP library to generate PDF documents and barcodes
https://tcpdf.org
Other
4.18k stars 1.51k forks source link

Add page cache option to save memory #474

Open ssigwart opened 2 years ago

ssigwart commented 2 years ago

Running example_067.php with and without the cache enabled uses about 26MB without vs 17MB with the cache.

This adds the usePageCacheFile option which allow you to move page data to a temporary file when not in use.

ssigwart commented 2 years ago

Thanks for reviewing it, @williamdes! I think I got all the changes in and updated all the ifs.

ssigwart commented 2 years ago

@williamdes, I assume someone else will merge this at some point, right? I don't seem to have permission.

williamdes commented 2 years ago

@williamdes, I assume someone else will merge this at some point, right? I don't seem to have permission.

Yes, when Nicolas will have some time he will probably review this :) Now we need to be patient

ssigwart commented 2 years ago

Sounds good. Thank you.

ssigwart commented 11 months ago

I rebased this to fix the merge conflicts with the examples.

codecov-commenter commented 11 months ago

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (5fce932) 69.28% compared to head (f186d90) 72.96%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #474 +/- ## ========================================== + Coverage 69.28% 72.96% +3.68% ========================================== Files 128 129 +1 Lines 26961 21974 -4987 ========================================== - Hits 18679 16034 -2645 + Misses 8282 5940 -2342 ``` | [Flag](https://app.codecov.io/gh/tecnickcom/TCPDF/pull/474/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tecnickcom) | Coverage Δ | | |---|---|---| | [php-5.3-ubuntu-latest](https://app.codecov.io/gh/tecnickcom/TCPDF/pull/474/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tecnickcom) | `?` | | | [php-5.4-ubuntu-latest](https://app.codecov.io/gh/tecnickcom/TCPDF/pull/474/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tecnickcom) | `?` | | | [php-5.5-ubuntu-latest](https://app.codecov.io/gh/tecnickcom/TCPDF/pull/474/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tecnickcom) | `?` | | | [php-5.6-ubuntu-latest](https://app.codecov.io/gh/tecnickcom/TCPDF/pull/474/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tecnickcom) | `?` | | | [php-7.0-ubuntu-latest](https://app.codecov.io/gh/tecnickcom/TCPDF/pull/474/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tecnickcom) | `?` | | | [php-8.3-ubuntu-latest](https://app.codecov.io/gh/tecnickcom/TCPDF/pull/474/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tecnickcom) | `72.96% <84.53%> (?)` | | | [php-nightly-ubuntu-latest](https://app.codecov.io/gh/tecnickcom/TCPDF/pull/474/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tecnickcom) | `72.96% <84.53%> (?)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tecnickcom#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/tecnickcom/TCPDF/pull/474?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tecnickcom) | Coverage Δ | | |---|---|---| | [examples/example\_068.php](https://app.codecov.io/gh/tecnickcom/TCPDF/pull/474?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tecnickcom#diff-ZXhhbXBsZXMvZXhhbXBsZV8wNjgucGhw) | `100.00% <100.00%> (ø)` | | | [include/tcpdf\_page\_cache\_reference\_counts.php](https://app.codecov.io/gh/tecnickcom/TCPDF/pull/474?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tecnickcom#diff-aW5jbHVkZS90Y3BkZl9wYWdlX2NhY2hlX3JlZmVyZW5jZV9jb3VudHMucGhw) | `100.00% <100.00%> (ø)` | | | [tcpdf.php](https://app.codecov.io/gh/tecnickcom/TCPDF/pull/474?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tecnickcom#diff-dGNwZGYucGhw) | `71.69% <70.58%> (+3.77%)` | :arrow_up: | ... and [81 files with indirect coverage changes](https://app.codecov.io/gh/tecnickcom/TCPDF/pull/474/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tecnickcom)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

ssigwart commented 11 months ago

I also updated this so it passes the unit tests, including on PHP 5.3.

williamdes commented 9 months ago

I also updated this so it passes the unit tests, including on PHP 5.3.

Thank you ! We will have to wait on @nicolaasuni to a review