|
Posted by Curtis on 01/30/07 09:16
On Mon, 29 Jan 2007 07:47:01 -0800, Michael Fesser <netizen@gmx.de> wrote:
> .oO(www.gerardvignes.com)
>
>> Have you run into a situation where you had to switch from PHP 4.x.x
>> to Perl 5.x.x in order to get better performance?
>>
>> I am using an OO approach to PHP for my website's server code. There
>> is one tiny script, with dozens of small objects. Each object is in a
>> separate source file.
>
> Same here. A lot of small, highly specialized components. Works very
> well and is quite easy to maintain and extend, but the problem is the
> overhead in object instantiation, since all these objects have to be
> created again and again with every single page request. In fact I'm
> kinda reaching the limit of what makes sense to do with OOP in PHP.
>
> But this is something that can't be easily solved with PHP alone.
>
>> It is a bit slow, even when the code doesn't do much DiskIO or MySQL.
>>
>> My webhost (NetSol) uses PHP 4.4 running on Apache 1.3 and Linux.
>
> Ugly. Much better would be PHP 5.2 (improved memory manager) and a
> bytecode cache like APC, which can really speed things up.
>
>> I have to option to use Perl 5.8.7. That is the only alternative they
>> give me at this time.
>>
>> Without doing the rewite, I am trying to determine if I can expect any
>> real improvement in performance.
>
> I don't use Perl (I simply don't like it), so I can't say much about its
> OOP performance. But I wouldn't expect too much of an improvement.
> Whether you create 40 objects in PHP or in Perl - the main problem
> remains.
>
> On the long run the solution for me will most likely be an application
> server, which avoids the repeated re-creation and re-initialization of
> all my application objects. Then they are created just once when a new
> session is started and remain in memory, ready to handle any requests.
>
> Micha
Perl is an awesome language, in my opinion. Getting used to its OOP
facilities can be a bit of a challenge, though. Unlike PHP, it makes use
of namespaces.
It is unlikely that PHP is causing such a significant bottleneck. It's
more likely that the trouble is at the server or database.
My apologies if the lines in this message weren't wrapped properly, I'm
testing newsreaders (trying Opera, very cool, so far). There didn't appear
to be a setting to control this, so I'm hoping it knows better.
--
Curtis
[Back to original message]
|