Re: how to possibly cache something and the theory of better performance / better speed

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

 



On Wed, 2008-04-02 at 00:26 -0400, Joey wrote:
> Hi All,
> 
> [-- SNIPPITY SNIP SNIP --] 
> 
> Assuming only 25-30 images am I splitting hairs here? Does this make
> sense?
> Of course if I have 200 pictures, then this is the way to go but would
> this
> really make a difference?

Randomizing the file referred to in the HTML <img /> tag is probably
faster than requesting a script that returns random image binary
content. For one, you avoid browser cache issues. Two, the browser will
cache the requested image so if it happens to be the random one in
another page request then it won't be re-downloaded. Now using the first
solution of generating a random src value for an image tag, caching the
list of image options will probably have very little effect since you
will either:

    a) have to request the cache from a database
    b) request the cache from the filesystem
    c) install and configure memcache and retrieve the cache from memory

Generally speaking, for 25 to 30 images, you're operating system will do
a good job of keeping the list in it's own cache and returning that list
very promptly when you perform opendir() and subsequent readdir()
requests.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
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