raintpl3 icon indicating copy to clipboard operation
raintpl3 copied to clipboard

Possibly optimize checkTemplate function

Open xPaw opened this issue 11 years ago • 4 comments

I feel like this function could be optimized quite a bit by caching some variables, and not re-calculating them every time the function is called. checkTemplate is always called regardless of cache, and if you have a lot of {include}'s in your code, it's called multiple times.

What do you think?

xPaw avatar Aug 06 '13 14:08 xPaw

complex to solve: memcached and APC are server specific session are slow and each user has its own

A fast solution it could be with a watch script (crontab or screen) that compile the template when they change, and on the Tpl class a configuration that tell RainTpl to just load the template, something like $conf["compile_template"] = false;.

With APC enabled this will go even faster.

feulf avatar Aug 06 '13 15:08 feulf

I think memcached/apc support would be great, perhaps just have user define their own get/set functions for cache, so they can use their existing memcached connections. And if these are not defined, fall back to how it is right now.

xPaw avatar Aug 06 '13 15:08 xPaw

that could be nice, I think the best way is to have a cache plugin where to implement all these features

feulf avatar Aug 06 '13 16:08 feulf

A super simple solution along the lines of what @rainphp mentioned would be a config option to skip_compile and add a script that compiles all the templates in the defined template folders, and moves these to the cache/compiled folder. If skip_compile === true then just load the template directly from the cache dir. :)

thedavidscherer avatar Jun 09 '14 18:06 thedavidscherer