latte
latte copied to clipboard
`PhpHelpers::optimizeEcho()` is very memory consuming
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.
I don't have Blackfire. Could you check where those allocations occur?