bcosca / fatfree

A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!
2.66k stars 446 forks source link

BASE->recursive #1282

Open fproperzi opened 3 months ago

fproperzi commented 3 months ago

With xdebug.profile+QCacheGrind on medium complex Controler+Model I found a bottleneck on "function recursive($arg,$func,$stack=[]) {" in base.php: recursive ... the bottleneck is on the render of the page to call recursiverly function encode($str) {...} on all the hive. There is a solution to get this time back without set ESCAPE=false? Why not caching the static part (DICT, config.ini ...) of the hive encoded and use this with the part coming from Controller?

Rayne commented 3 months ago

The issue here is that the complete HIVE is implicitly forwarded and escaped for rendering a template. You can specify a custom HIVE / array when rendering templates to minimize the amount of data that has to be escaped. If you want to have access to a whole escaped HIVE this will of course not solve the issue.

For the record, the question is also asked here: https://stackoverflow.com/questions/78430283/fatfreeframework-bottleneck-in-function-base-recursive-to-encode-all-the-hive