Beware the "Hello World" test in regards to framework performance
comparisons. If performance is your _only_ concern, there is only one
recommendation to make; don't use a framework. However, if your
requirements are those that can allow for making your development
easier, a framework might be right for you. Heck, even Yahoo has a
framework and for them, response times are measured in milliseconds.
The reason I say to watch out for simple application comparisons (i.e.
Hello World or something with even just a few hundred lines of code) is
that they do not represent real life applications, or the development of
real life applications. As such, it is likely that any conclusions that
are reached will be significantly skewed against a framework. There are
many additional concerns to take into account.
I have 2 specific examples I have in mind. One is a framework based
application having performance problems, the other is a non-framework
based application having performance problems. Both of them had the
same type of problem. With the non-framework based application I was
able to build a mechanism that increased performance by a factor of 3
and it took me about a day to get it right, with one example built. The
code was difficult to implement and was going to require a lot of
refactoring to make it work. But I was able to get the performance
increase needed.
In the other example, the application was a Zend Framework based
application and I was able to use the same type of methodology to gain a
2.5x increase in performance. Ironically, the ZF application was just
as fast as the vanilla PHP (vPHP) app. However, it took me about 3
hours to build and test a front controller plugin that did the exact
same thing. Plus I was able to implement it in 5 individual places. In
the vPHP app it would take at least 30 minutes to implement the feature
in another part of the code, testing it and making sure that it would
work. The framework-based app, it would take about 15 seconds,
including the time to hit Save.
My thinking on the subject of frameworks is that if it is a relatively
simple application (say 5-10k lines of code to pull out a random number)
that does not have a lot of dependent (or moving) parts, or speed is of
the utmost importance (it probably isn't), a framework may not be for
you. However, if you have an application with multiple developers (or a
combination of PHP and HTML/Javascript folk), a fair amount of
functionality or integration points, or a deadline, a framework would be
something you might want to look at.
In terms of which framework to use, I will obviously be biased. My
preferred framework is Zend Framework. Though a vast majority of that
preference is based off of architecture and not employment. I really
think we got it right. My next preference would be Code Igniter because
I like fast applications. Symfony would probably be next on the list.
I am personally not a fan of rigidly structured frameworks since if you
have application requirements that are even slightly outside of that
structure you either have to code your way out of it or you might just
be stuck. That is one of the reasons why I prefer Zend Framework. I
have the structure when I need it and the flexibility when I need it.
You do pay a performance price but when it is compared with additional
content required for rendering the page such as images, CSS or (even
worse) Javascript, the framework will probably not be the worst place.
In fact, I'm looking at an example right now where the PHP performance
represents 1/40th of the problem. In my experience, _that_ is more
typical of a web-based performance problem than comparing a 600ms to 2ms
response time.
Kevin
-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Nathan Andelin
Sent: Thursday, September 10, 2009 5:22 PM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] PHP - Best Appication Structure
From: Jon Paris
ATK framework from iBuildings ... is heavily focussed on
building business applications.
There has been some concern expressed in php forums about the
performance of frameworks, and having a lot of OO code running
interpreted.
A demo at the ATK site enables editing and posting changes to an
employee record, consisting of 6 fields. An HTTP POST is followed by an
additional HTTP GET, with average response times as follows:
POST: 900 milliseconds
GET: 500 milliseconds
I compared that to one of my programs for editing and posting changes to
a person record, consisting of 5 fields. Coincidentally, my interface
also uses an HTTP POST, followed by an HTTP GET, with an average
response time (to last byte):
POST: 3 milliseconds
GET: 2 milliseconds
There would be some delay from the ATK site of course, due to internet
bandwidth. But that delay would be less than 100 milliseconds. The RPG
program still appears to offer about 260 times better performance.
There may be some rationalle for keeping php scripts as small as
possible.
-Nathan.
As an Amazon Associate we earn from qualifying purchases.