Re: Re: PHP programming strategy; lots of little include files, or a few big ones?

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

 



On Thu, 07 Jan 2010 22:48:59 -0500, robert@xxxxxxxxxxxxx (Robert Cummings) wrote:

>clancy_1@xxxxxxxxxxxx wrote:
>> Thank you all for your comments. I did not know about bytecode caches. They're an
>> interesting concept, but if I am interpreting the paper
>> http://itst.net/654-php-on-fire-three-opcode-caches-compared correctly they only double
>> the average speed of operation, which is rather less than I would have anticipated. 
>
>I strongly advise that you take the time to try a bytecode cache. Within 
>linux environments I am partial to eaccelerator. In IIS environments I 
>now use WinCache from Microsoft. From my own observations with a 
>multitude of different types of PHP web applications I find that the 
>speed gain is closer to 5 times faster on average.

Five times faster is certainly more attractive than twice as fast. But under what
circumstances is this achieved? Unfortunately these days it is difficult to find any solid
information on how things actually work, but my impression is that caches only work for
pages which are frequently accessed. If this is correct, and (as I suspect) somebody looks
at my website once an hour, the page will not be in the cache, so it won't help. Also one
of the more popular parts of this website is my photo album, and for this much of the
access time will be the download time of the photos. Furthermore as each visitor will look
at a different set of photos, even with heavy access it is unlikely that any given photo
would be in a cache. 

Despite these comments the access times for my websites seem to be pretty good --
certainly a lot better than many commercial websites -- but have a look at
http://www.corybas.com/, and see what you think. (I am in the process of updating this,
and know that the technical notes are not currently working, but there is plenty there to
show you what I'm trying to do.)

>> As I would have to understand yet another system to implement them, and I suspect I'd have
>> to do a significant amount of rearranging, I don't think I will worry about them unless my
>> webpages unexpectedly become extremely popular.
>
>That's your perogative, but you started this thread with a question 
>about file access times. By your latest argument (above) you may as well 
>ignore it since when and if the issue becomes salient then you can worry 
>about it. However, I think that's disingenuous at best since your pages 
>will appear slower on average, and you're just wasting CPU resources.

Unfortunately I am cursed with an insatiable curiosity, and spend far too much time
thinking about philosophical questions like this. But I have also been programming almost
forever, and I have learned that it would now take me five times as long as (I hope) it
would take you to implement something new like byte code caching.

>> Al's suggestion that my code is probably infinitesimal compared with PHP suggests that I
>> shouldn't be worrying about memory requirements.  On the other hand I agree with David
>> that the advantages of using relatively small easy to understand modules probably outweigh
>> the costs of loading a larger number of files.
>
>You've missed several points. Bytecode caches allow you to skip the trip 
>to the filesystem. They allow you to skip the parse and compile stage of 
>PHP. They almost always make your shit run faster.

Perhaps. But my visitors appear to be happy now, and my hosts aren't complaining that I'm
overloading their system.

Clancy

PS. It does sadden me that there don't seem to be many people here who are interested in
the philosophy of programming, as against the quick and dirty fix.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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