How much Smarty is good for health??
Moderator: General Moderators
How much Smarty is good for health??
Hi All
I have been working on a site with Smarty Template Engine and found it quite useful.
However I was wanting to know how much does Smarty, or any other template engine for that matter, affect performance?
My site needs one kind of navigation bar on the top and side to be shown when the user is not logged in and another kind to be shown when the user logs in.
So is it OK if I create template files that load based on the user's log in status OR is it better to include static PHP files?
Thanks and Regards
I have been working on a site with Smarty Template Engine and found it quite useful.
However I was wanting to know how much does Smarty, or any other template engine for that matter, affect performance?
My site needs one kind of navigation bar on the top and side to be shown when the user is not logged in and another kind to be shown when the user logs in.
So is it OK if I create template files that load based on the user's log in status OR is it better to include static PHP files?
Thanks and Regards
smarty can be quicker for pages where alot of processing is done to create the page as it caches the pages it creates, meaning that frequently used pages will already be cached with out the need to processed. I've used smarty a few times now and I think it doesn't affect performance in any detrimental way, infact I normally notice pages loading faster if anything. About the only problem I ever had with smarty was with dreamweaver templates which just tore the website apart every time we tried to do an update.
Thanks for the reply phpdevuk.
Yes, since it caches the pages the overheads should not be more than loading a PHP page directly.
But what happens when the template changes? Smarty wipes out the old cache and puts in the new page? Maybe uses the file timestamp to check if the page changed?
Thanks and Regards
Yes, since it caches the pages the overheads should not be more than loading a PHP page directly.
But what happens when the template changes? Smarty wipes out the old cache and puts in the new page? Maybe uses the file timestamp to check if the page changed?
Thanks and Regards
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
I have never used Smarty. I create my own classes and re-use them throughout my site. It is not that I am against frameworks, it is more that I first want to have a strong understanding of how to do everything myself first and then look into frameworks after. I admit I am weary of frameworks as they seem to change with the seasons.
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
Smarty is a template engine - not a Framework. Horde, WACT, etc. are Frameworks. Actually I don't use frameworks myself - I rely entirely on a loosely bound base made up of common 3rd party libraries. It's something I'm looking to port into a single project on SF so its more easily utilised by anyone interested... I just find the usual frameworks a moving target with a steep learning curve...too much to invest for a benefit that's not all that apparent. Maybe I'm just a stickler for seeing all the processes in my applications...
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
This is the real thing... and since we're developers we do like to see all the processes in our applicationsMaugrim_The_Reaper wrote:I just find the usual frameworks a moving target with a steep learning curve...too much to invest for a benefit that's not all that apparent. Maybe I'm just a stickler for seeing all the processes in my applications...
Yapter
I'm using yapter for a while now,
Easy to use template system. And it hardly changes.
http://yapter.sf.net
Easy to use template system. And it hardly changes.
http://yapter.sf.net
Smarty is really designed to be used with an opcode cache. As long as you have one, you needn't worry about smarty's performance.
Here is an excerpt from the results of a benchmark from WACT, run without an opcode cache, that can give you an idea about the relative performance difference between using smarty and not using templates at all:
Here is an excerpt from the results of a benchmark from WACT, run without an opcode cache, that can give you an idea about the relative performance difference between using smarty and not using templates at all:
Code: Select all
no templates + Native SQL Requests per second: 31.57 [#/sec] (mean)
Smarty + Native SQL Requests per second: 7.00 [#/sec] (mean)