Re: Architecture patterns in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 30, 2008 at 12:26 AM, Manuel Lemos <mlemos@xxxxxxx> wrote:

> Hello,
>
> on 12/30/2008 05:07 AM Nathan Nobbe said the following:
> >>>> How do you structure your web applications? I am thinking in terms of
> >>>> separating presentation  and logic. How is that done in PHP? And how
> >>>> many architecture patterns are there?
> >>>
> >>> Well,
> >>>
> >>> I use, way of Rasmus (I give that name)
> >>>
> >>> and please read this why
> >>>
> >>> http://talks.php.net/show/drupal08/0
> >> After you watch that presentation, the conclusion that you reach is if
> >> you want to develop a site that only shows a page saying "Hello world!"
> >> you should not use an MVC framework because it adds to much performance
> >> overhead! ;-)
> >>
> >
> > it also acts as a nice control mechanism to compare so many frameworks,
> > trivial php, and html.  really nice to see the numbers like that; so cake
> is
> > horrifically slow, solar & zend are pretty fast and code igniter is like
> > twice as fast as those.
>
> I am not sure if that conclusion is correct. Were the benchmarks done
> using a PHP cache extension?


im not sure, maybe ill ask him though.


> If not, the results may just show that Cake
>  includes more code probably because it is more mature than others that
> are younger.


hmm, im not so sure about that.  code igniter is specifically designed to be
fast, and it clearly is.  it would be interesting to see feature comparison
charts but im sure both zend and ci stack up against cake in that regard.

What happens is that PHP code is compiled in zend opcode before
> executing. The more code split in include files you load, more time it
> spends loading the code before executing. When you use a PHP cache
> extension, the compile phase is skipped and replaced by loading compiled
> PHP code from cache. So most of the time is taken actually by executing
> the code.
>

> Therefore using the PHP cache extension may give more useful results to
> compare framework execution overhead.
>

well, heres a series of tests that compare the aforementioned frameworks in
much the same manner, using different caching solutions, and you can see the
differences are grossly exagerated when the opcode cache is running.  cake
w/ the opcode cache is appauling compared to ci, and zend is substantially
faster both with and without the cache as well.

http://www.avnetlabs.com/php/php-framework-comparison-benchmarks

> i also like how rasmus shows several advanced optimization techniques, via
> > strace and gdb.  ive not used the 'included' extension, ill probly check
> it
> > out.  you know some of us yougin's never really got too much pratical
> > exposure to tools like that =/  im still ramping up on these low level
> > utilities myself.
>
> Those may not be the best tools to tell you what PHP code is taking more
> time to execute, as they only show system calls.


i dont recall calling them 'the best tools'.  i said 'advanced optimization
techniques', which they can clearly can be.


> There are PHP profiler
> extension that give you a better vision of the actual PHP code that may
> be slowing down things.


i dont think ive ever seen a warning about the system timezone misusage on a
kcachegrind graph :p


> strace is more useful for PHP core developers as it tells which system
> calls are more expensive and could be worth some optimization.


in general sure;  but i would also say theyre fair game for the advanced
optimizer as well.

plus did you see the part about 'cleaning up the include path'.  moving to
require at the outer layer and as far in as possible, basically.  thats a
really good idea, and it looks like this 'includes' extension is well suited
for tweaking in that manner.  i may end up adding it in the arsenal
alongside xdebug+valgrind.

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux