I load XML files from disk using file_get_contents, and as a test I can load a 156K file using file_get_contents() 1,000 times in 3.99 seconds. I have subclassed the part that loads and replaces it with the memcache level, and on my machine computer will find 1000 downloads of the same document in 4.54 seconds.
I appreciate that file_get_contents () will do some caching, but it looks like it is actually faster than the well-known caching method. On one server, the performance of file_get_contents() no worse than what you can get?
I am on PHP 5.2.17 through Macports, OS X 10.6.8.
Edit: I found in XML documents of this size, there is a slight advantage in using the MEMCACHE_COMPRESSED flag. 1,500 downloads via memcache are performed after 6.44 s (with compression), and not 6.74 (without). However, they are slower than file_get_contents , which does the same amount of load in 5.71 seconds.
php file-io php-internals memcached
halfer
source share