A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2008 yearSmarty benchmark, anyone? - page 1
User InfoPosts
Smarty benchmark, anyone?#1
I am considering Smarty as my web app templating solution, and I am now concerned with its performance against plain PHP.

The Smarty site says it should be the same, however, I was not able to find anyone doing real benchmarking to prove the statement right or wrong.

Did anyone do some benchmarking of Smarty vs plain PHP? Or maybe come across some resources on such tests?


posted date: 2008-12-13 00:15:00

Re: Smarty benchmark, anyone?#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2008-12-13 00:15:01

Re: Smarty benchmark, anyone?#3
Just found this very simple benchmark - propably not very significant.

posted date: 2008-12-13 02:05:00

Re: Smarty benchmark, anyone?#4
Because in the end, Smarty compiles and caches the templates files to native PHP-code, there is indeed no theoretical performance difference.Of course there will always be some performance loss due to the chunk of Smarty-code that needs to be interpreted every time.

posted date: 2008-12-13 08:25:00

Re: Smarty benchmark, anyone?#5
Smarty generates PHP code for all its template files when they're first used, provided you have it set up correctly, and uses them when possible instead of parsing the templates again.I used it for a while and it was fast enough, but in the end I swapped it out for plain PHP files because it was a bit limiting (too many PHP4-isms).

posted date: 2008-12-13 08:31:00

Re: Smarty benchmark, anyone?#6
Smarty itself is rather a large library... If your going to use Smarty, I suggest you use APC to cache the compiled version.. It will offset the rather large size of the Smarty library...

posted date: 2008-12-13 10:24:00

Re: Smarty benchmark, anyone?#7
It depends on how you use Smarty because the flow of your pages can changeClassic plain PHP flow:OutputHandle $_REQUEST dataOutputHandle database queriesOutputHandle $_REQUEST dataOutput...Classic Smarty flow:Handle all $_REQUEST dataHandle all database queriesOutput allIf plain PHP took 1.0 sec for this page the Smarty page also takes 1.0 sec. BUT if we assume that all database and $_request handeling takes 0.7 sec. The plain PHP starts output directly while the Smarty version starts outputing after 0.7 sec. Therefor the browser can start downloading stylesheets and images faster.No output also means the "Stop" button has no effect.However in Smarty you can call functions and methods from within the template.Delaying the slow part to where the data is needed.

posted date: 2008-12-13 12:05:00

Re: Smarty benchmark, anyone?#8
There is a drop in replacement for Smarty called Template Lite which is much more lightweight in respect to the library file size. That said, I have used the original Smarty in some extremely high load situations without needing to swap in this library.

posted date: 2008-12-13 12:36:00

Re: Smarty benchmark, anyone?#9
You might also want to take at a new template library that is similar to Smarty called Dwoo

posted date: 2008-12-20 22:29:00

Re: Smarty benchmark, anyone?#10
Based on my own experiences and informal benchmarks, Smarty doesn't by itself cause any major performance reductions. However, when you get into writing custom plugins, things go downhill. A Smarty template is compiled & cached as PHP, but a custom plugin is always loaded and executed at runtime and is always slower than running the same code in a plain old PHP file. You're not going to notice this too much with a custom string formatting plugin, but you'll definitely see it when doing database queries in a plugin.Overall, I highly recommend Smarty. Getting the display out of the PHP has made our code so much more readable and maintainable. You just have to make sure you're careful about what you put in plugins.

posted date: 2009-02-11 08:00:00

Re: Smarty benchmark, anyone?#11
here's another templating solution XSLT here are my benchmarks for one of the pages i converted (its a simple page):// with smarty (baseline) 0.014 seconds// with xsl/xslt-clientside 0.008 seconds 42% decrease in server stress// with xsl/xslt-serverside// this process would only be done if the users browser doesn't support client-side XSLT 0.016 seconds 14% increase in server stressIts not for everyone but if performance is your main concern :)On top of that you allow the client to cache your template.here's an example of what I'm doing (this is one of my sites): http://pixao.comand here's another example of it on a larger scale site: http://worldofwarcraft.comso far i have yet to run into any show stoppers

posted date: 2009-05-09 20:35:00

Re: Smarty benchmark, anyone?#12
The domain is no longer online, but here's a good replacement cedric.emisfr.info/en/2010/03/25/…

posted date: 2010-07-01 11:31:00

select page: « 1 2 »
Copyright ©2008-2017 www.momige.com, all rights reserved.