latte icon indicating copy to clipboard operation
latte copied to clipboard

`PhpHelpers::optimizeEcho()` is very memory consuming

Open kukulich opened this issue 9 months ago • 1 comments

We have problem after upgrade to PHP 8.4 that generating templates consumes a lot memory. We don't know what changes in PHP 8.4 but I think it does not matter. We use Blackfire to profile it and see the result in screenshot.

The problem is token_get_all in PhpHelpers::optimizeEcho(). Would it be possible to implement parametr $optimize in TemplateGenerator::generate() so the optimization could be disabled?

We are ready to provide the PR.

Image

kukulich avatar Feb 26 '25 08:02 kukulich

I don't have Blackfire. Could you check where those allocations occur?

dg avatar Feb 26 '25 16:02 dg