What causes WordPress plugins to be slow?
WordPress plugins are great in general as they really extend the possibilities of the platform. We love theme builders, SEO plugins and many others. We simply can’t live without them. But what causes plugins to take a hit on your WordPress website?
Let’s kick off with the true bottleneck of webhosting. You can rent many CPU’s and RAM’s, but webservers often put hundreds or thousands of websites on the same storage hardware. Luckely enough, this is the age of wonderfull hardware like NVMe SSD’s. But still, these are the bottlenecks.
SSD’s are limited in performance based on the number of IOPS they can execute in a certain period of time. These are input/output operations. When an SSD is reading or writing data (writing/input is slower), that process blocks other IOPS from happening. That’s where RAM pop’s in. It’s the most expensive hardware of the server as it’s lightning fast at serving up cached data. But the amount is pretty limited compared to your storage space.
To leverage the performance you get out of IOPS, it’s smart to use as little files as possible on your server. A plugin consisting of a single file with 1000 lines of code will load faster than a plugin having 10 files with 100 lines of code each. This because the storage hardware will have to locate each and every file every time WordPress loads.
This is why WP Switches are all built as a single file that needs to be loaded by WordPress. This means we add just one output operation to your WordPress install.
Pro tip, you can download the Switches you need and combine all the code in just one file!
As you read above, the server memory (RAM) is the most expensive part of your webhosting setup. So to keep performance up, it’s wise to use as little as possible.
Many plugins write their settings to a table called WP Options. If you take a peak into your database, you will notice there’s a field called autoload. When that’s set to true, those settings will be loaded from the database and put into the memory of your webserver on every visit to your website. So it’s smart to keep this as clean as possible.
Pro tip: remove all WP Options settings of plugins and themes you are no longer using!
At WP Switches we are not adding any records to the WP Options table at all. WP Switches are designed to do just one thing. The code is executed as soon as the WP Switch has loaded.
The biggest issue however, is code bloat. There are so many plugins that introduce thousands of options to the WordPress owner. Often just one or two of such options are really used. This means those plugins are consuming IOPS, RAM and CPU cycles without delivering a benefit to your website.
Another issue is security. All those lines of code, need to be maintained. Need to be audited by their developers for security. At this day of age, the WordPress community is often facing zero-day security breaches on big plugins and themes. With a slimmed-down codebase, there’s simply less to worry about.