Re: [PHP] PHP4 vs PHP5 Performance?
- From: larry@xxxxxxxxxxxxxxxx (Larry Garfield)
- Date: Sat, 25 Aug 2007 12:28:07 -0500
Robert and everyone: PLEASE do not reply to list AND the sender, at least not
when I'm the sender. I don't need double copies of every message in every
thread I participate in. Thanks.
On Saturday 25 August 2007, Robert Cummings wrote:
There is no way to respond to the above request, because you're
automatically discounting features as "an individual bent". That makes
your position non-falsifiable (cannot be proven or disproven), and
I'm indicating that features should not be the sole basis of the
argument since they are indeed an individual bent. As such it helps to
focus the argument to what is important-- the efficacy of PHP4 versus
the efficacy of PHP5. Thus my position is open to falsifiability and not
as you say "irrelevant".
What does PHP 5 offer?
- Exceptions. No you don't have to use them, but they are a useful tool.
- Real OOP. No, you don't have to use it, but it is a useful tool.
Ooooooooooooooh, the magical "Real OOP". Please go find me a definition
of "Real OOP". PHP4 is as real OOP as any other OOP. Just because it
lacks some devices available in other OOP implementation does not
disqualify it in any way from being OOP.
- Prepared statements in MySQL (mysqli) or cross-database (PDO). You
really should be using them!
There are pros and cons to prepared statements:
Sure there are. But if all you have is the mysql_ extension, you don't get to
make that choice.
- filter extension. No you don't have to use it, but it's a useful tool
Sure, but you can filter your variables for security without it.
Sure you can. You could do it in C, too, and then you don't need PHP's
overhead. The "you can accomplish it without this tool" argument carries no
weight since the whole point of the tool is "but I can accomplish it in far
less time with less code and fewer bugs with it".
You can build a house using nothing but a hand saw, but a buzz saw makes it oh
so much easier. :-)
- SPL. You can leverage SPL without having a fully-OOP architecture. In
fact, I find it most useful to be able to "have my procedural cake and
OOP icing, too". No, you don't have to use it, but it's a useful tool.
But it doesn't offer much to a fully procedural architecture.
Have you tried it?
- SimpleXML and the DOM extension. XML handling that doesn't suck ass.
No you don't have to use them, but if you're doing anything with XML
processing you will thank the gods that you did.
I already have an XML API that works fine in PHP4.
There's only a narrow sliver of use cases where I'd say PHP 4's primitive SAX
parser "works fine". Perhaps you're only working in those, but if you're
doing anything more complex then the extra tools make life a hell of a lot
- A few dozen new utility functions. Sure they could be/have been
reimplemented in PHP 4 user-space, but they're not as fast as when
implemented in C.
True, but that's a compatibility / performance tradeoff. And there
doesn't need to be a tradeoff. You can test for PHP4 and include the PHP
versions if PHP4 is active. Otherwise default to PHP5 C implementations.
You have to be careful how you structure the code, though. Conditional
function definitions still get compiled even if they aren't "defined", so
there's no memory savings.
The GoPHP5 project is not about forcing people to use OOP. It's about
ensuring that developers have a full tool box available to them when
writing code. If you're still using PHP 4 now, then your tool box is
only half-full. Get on PHP 5 to get the other half.
I never said gophp5 was about forcing the use of OOP. It just strikes me
as an unnecessary push when market forces will perform the appropriate
pushing at the appropriate time. GOPHP5 is an artifical push for a
faster move towards an inevitable future.
GoPHP5 *is that market force*. It's developers saying "OK, we're sick of PHP
4, it's time for PHP 5, get with the program". Hosts that don't keep up,
well, that's capitalism. It's well past the "appropriate time".
And actually, what I've found from GoPHP5 is that the Nexen stats showing 20%
PHP 5 deployment on a good day are bunk. There's no shortage of PHP 5
compatible hosts, including the big names. We've been holding ourselves back
The other factor is that those writing code that goes on servers they
don't have absolute control over (I dare say most of us) are bound by
*others'* refusal to upgrade to PHP 5. If I'm on a shared host, I'm
stuck with whatever that host is running, even if it's ancient.
I've nothing against running your stuff in PHP5, nothing against it at
all. But I don't see what the problem is with maintaining PHP4
compatibility while enjoying PHP5 if you so choose to use PHP5.
Because it is not possible to use SimpleXML or SPL or PDO etc. while
maintaining PHP 4 compatibility, unless you write two completely separate
implementations with a common facade. That's a complete waste of my time. I
can't enjoy PHP 5's exceptions (if I am so inclined) without cutting off PHP
4 servers. While there were lots of PHP 4 servers, most mass-market projects
were too afraid of cutting off their own install base to do so. Now, though,
they have enough "market force" in toto that it's not a big risk to open up
to PHP 5 features.
*waves a tiny "gophp5" flag* Yaaaaaaaay!
Larry Garfield AIM: LOLG42
larry@xxxxxxxxxxxxxxxx ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
- Re: [PHP] PHP4 vs PHP5 Performance?
- From: Robert Cummings
- Re: [PHP] PHP4 vs PHP5 Performance?
- Prev by Date: Re: html to jpeg conversion.
- Next by Date: Re: [PHP] PHP4 vs PHP5 Performance?
- Previous by thread: Re: [PHP] PHP4 vs PHP5 Performance?
- Next by thread: Re: [PHP] PHP4 vs PHP5 Performance?