I’ve been using WordPress for about 4 years now. In the past couple of years I’ve noticed that WP has become noticeably slower than it used to be.
I am working on a custom theme for WordPress, so I downloaded the latest version (3.1) and installed it, imported posts from my production WordPress blog (to my dismay I had to install an importer to import WordPress’ own XML files because WordPress does not have this functionality by default!), and got up and running.
During the installation process it seemed slow to me on my home computer which is much less powerful than the shared web server I am on. I didn’t think much of it until I tried viewing the blog. Slow!
As a little test, I called PHP’s get_included_files() function in the default theme’s footer to see how many file includes there are. There are 77 files included on index and post page views–including the WordPress importer file which is certainly not needed when viewing the blog.
This is insane! While WordPress is a nice script with lots of great features, whoever is designing this thing needs to take some computer programming classes or something because including that many files–especially files that are not needed–creates a huge amount of overhead. Efficient coding IS important–especially with interpreted code.
When I develop a site, I try to keep the number of includes as few as possible. Every file included requires the server’s hard drive to seek for the file and that takes time. Hard drive access is the slowest part of the entire operation. If everybody was on a server with an accelerator that cached the opcode to RAM (assuming the entire script was cached and executed from memory), this wouldn’t be too much of a big deal. But we are not.
index.php includes wp-blog-header.php which does NOTHING but to see if the $wp_did_header flag is set and if not, requires two more files and executes a function.
Do you people not see how ridiculously wasteful this type of coding is???
You would be MUCH better off stuffing more code into fewer files than having to go through the time-consuming process of including a file for only a few lines of code.
Thanks for reading.
- The topic ‘77 Files Included Per Page View! Insane!’ is closed to new replies.