<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dev4Press&#187; optimization Tag Archives, page 1 of 1 | Dev4Press</title>
	<atom:link href="http://www.dev4press.com/tag/optimization/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dev4press.com</link>
	<description>Premium Plugins and Themes for WordPress</description>
	<lastBuildDate>Thu, 23 May 2013 09:33:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Plugin Optimization Success Story: Subscribe2</title>
		<link>http://www.dev4press.com/2012/blog/benchmark/plugin-optimization-success-story-subscribe2/</link>
		<comments>http://www.dev4press.com/2012/blog/benchmark/plugin-optimization-success-story-subscribe2/#comments</comments>
		<pubDate>Tue, 24 Apr 2012 13:15:00 +0000</pubDate>
		<dc:creator>MillaN</dc:creator>
				<category><![CDATA[Benchmark]]></category>
		<category><![CDATA[email subscriptions]]></category>
		<category><![CDATA[good optimizations]]></category>
		<category><![CDATA[good thing]]></category>
		<category><![CDATA[great job]]></category>
		<category><![CDATA[loader file]]></category>
		<category><![CDATA[main plugin file]]></category>
		<category><![CDATA[Matthew Robinson]]></category>
		<category><![CDATA[memory usage]]></category>
		<category><![CDATA[operation code]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[optimization analysis]]></category>
		<category><![CDATA[plugin code]]></category>
		<category><![CDATA[Plugin Optimization Success]]></category>
		<category><![CDATA[RAM usage]]></category>
		<category><![CDATA[simple plugin]]></category>
		<category><![CDATA[single file]]></category>
		<category><![CDATA[smaller files]]></category>
		<category><![CDATA[Subscribe2]]></category>

		<guid isPermaLink="false">http://www.dev4press.com/?p=16208</guid>
		<description><![CDATA[As you might know, I have written about plugins optimization many times already, including benchmarks. And, it is a great thing to know that some developers have taken the time to improve their own plugins based on my recommendations. Here is the story about one great optimization.]]></description>
				<content:encoded><![CDATA[<p>As you might know, I have written about WordPress plugins optimization many times already. And, it is a great thing to know that some developers have taken the time to improve their own plugins based on my recommendations. Here is the story about one great optimization.</p>
<p><strong>Subscribe2</strong> is free and excellent plugin for email subscriptions about new entries on the website. Plugin is created by Matthew Robinson and to get more info about it visit the plugin website: <a href="http://subscribe2.wordpress.com/" target="_blank">Subscribe2 Plugin</a>.</p>
<p>Previous benchmarks I did for this plugin showed that it used too much memory and that all the code was in one PHP file. For benchmark done in January 2012 I was testing Subscribe 7.0.1 released in November 2011. And based on those tests, I gave the plugin lowest grade for the optimization. My grading was not based only on memory usage or SQL queries, most important factor was based on the code review and the potential for optimizing it. There are instances where plugin uses a lot of memory and I still gave it good grade because of the way plugin loads and works. So, benchmarks included both measured data and optimization analysis.</p>
<p>Subscribe2 author Matt joined the discussion and he was defensive of the plugin and its performance. But, the great thing that come from the discussion is that Matt decided to give optimization a try, to see if my instructions on that really work and how he can improve his plugin. And it really did work, and Matt did a great job on optimizing Subscribe2 plugin. Over the last 2-3 months Matt and I talked about the optimization and I did more benchmarks, testing his optimization process that ended up with the release of 8.0 version of the plugin. Matt also provided me with a short text, where he describes his work on optimization.</p>
<blockquote><p><em><strong>Matt:</strong></em><br />
About two months ago as I type a user of my plugin drew my attention to a benchmarking assessment done at Dev4Press.com that had assessed and benchmarked a substantial number of WordPress plugins. This site noted that Subscribe2 had &#8220;Bad optimization results, must be improved&#8221;. Now I visited the site and noted that Subscribe2, in comparison to other more highly rated plugins, loaded pretty quickly, did not use much resource and used minimal SQL queries. I started to question the author of the review article, Milan Petrovic, about exactly how he had arrived at his conclusion that Subscribe2 was badly optimized in light of these comparatively good optimizations.</p></blockquote>
<p>If you want to read the full discussion we had back in January through comments, you can revisit original plugins benchmark article here: <a href="http://www.dev4press.com/2011/blog/benchmark/measuring-impact-of-plugins-on-wordpress-loading/comment-page-1/#comment-85982" target="_blank">Measuring impact of plugins on WordPress loading</a>.</p>
<blockquote><p><strong><em>Matt:</em></strong><br />
It became apparent that Milan was not only taking into account the raw data gleaned from his analysis of the execution of the plugin code but also reviewing how the code was written and thus optimized. He recommended that I break Subscribe2 down from essentially a single file into several classes and subfiles. Now, I have to say the prospect of doing this did not fill me with excitement. I am not a coder or programmer in my day job, I see Subscribe2 as a hobby. It&#8217;s code I use on my sites and I make it available to the wider WordPress community as it seems that a few of you find it useful too. Since I have no real formal education in coding I&#8217;ve learned everything I know from simple trial and error and through reading lots of documentation about PHP and WordPress functions. I find it much easier to have all the code in one place &#8211; one file.</p></blockquote>
<p>Great thing about WordPress is that making a plugin is very easy. And you can always start from simple examples, from documentation and you don&#8217;t need to know too much about PHP. In my experience, starting with simple plugin you can put all the code in one file. Start adding more code, and that file grows. And if you end up with the file that has 200KB of code, PHP will need a lot of memory to load file and to interpret it into operation code that is than executed. That code can take a lot more memory in the end.</p>
<blockquote><p><strong><em>Matt:</em></strong><br />
That said I thought I would test out Milan&#8217;s assertion that breaking the code up would make a difference. I&#8217;m a scientist really and I love to challenge theories, in this case I was skeptical at the start. So, I set about breaking Subscribe2 into 5 files, a loader, a core class and then 3 extender classes for the front end, the admin side and a special case for multisite installs. Once I&#8217;d finished this I emailed the code to Milan and he happily tested it for me. I was very surprised to see that the RAM usage and loading time on the front end had been halved by the changes. The admin side was pretty much unchanged.</p>
<p>Milan then made one last suggestion; he recommended that I break my code for the 4 administration side screens that Subscribe2 makes available into separate files too and load these only when the page was visited. So, again I set about making these changes and emailed the code to Milan once completed. Again, to my surprise the administration side RAM usage had dropped to less than half what it had been before, even on the largest of the Subscribes pages. Additional changes also saw RAM usage drop to about a quarter of what it had been previously.</p></blockquote>
<p>Matt did great job in splitting plugin into smaller files and making good folders structure to organize files based on their use and context. And main plugin file dropped in size from 200 KB to less than 3 KB. This loader file was than used to load only other plugin files based on the need for them.</p>
<blockquote><p><strong><em>Matt:</em></strong><br />
So, in summary, the review by Milan and the recommendations he made have left me with a faster and less resource intensive plugin. That can only be a good thing. On the downside it has caused me to split my plugin into lots of smaller files which I will find harder to manage and will therefore slow development down &#8211; but I consider that Subscribe2 is pretty feature complete now and I try to avoid adding new features unless they are adding value to the plugin to as large a number of users as possible, so perhaps that isn&#8217;t too bad a thing either!</p></blockquote>
<p>Now to the numbers. How much memory is saved with the optimization Matt did? Table below shows test results for old 7.0.1 and latest one 8.2.0 versions.</p>
<table class="d4ptable d4ppluginsmonthly">
<thead>
<tr>
<th></th>
<th colspan="2">Administration</th>
<th colspan="2">Frontend</th>
</tr>
<tr>
<th>Version</th>
<th>Memory</th>
<th>Time</th>
<th>Memory</th>
<th>Time</th>
</tr>
</thead>
<tbody>
<tr>
<td>Old, <strong>7.0.1</strong></td>
<td>1.3 MB</td>
<td>0.014 sec</td>
<td>1.3 MB</td>
<td>0.013 sec</td>
</tr>
<tr>
<td>Optimized, <strong>8.2.0</strong></td>
<td>0.4 MB</td>
<td>0.011 sec</td>
<td>0.3 MB</td>
<td>0.012 sec</td>
</tr>
</tbody>
</table>
<p>As you can see, on the admin side plugin uses <strong>70%</strong> less memory and on front end side <strong>77%</strong> less memory after optimization. That is a huge gain. On the admin side, depending on the plugin admin page loaded this memory usage varies, but it doesn&#8217;t go over 0.6MB, on all other pages it is 0.4MB. As for the loading time, this is measured on my test server. Depending on the server speed, plugin can load faster. This number here shows a slight gain in loading time also. In that regards, there is not much space to improve that further, considering that even the smallest plugin on my test server needs about 0.008 seconds to load. Subscribe2 is great in this area also.</p>
<p>From my experience, having more files for a plugin can help you down the road when you get to adding more features. You can make better and more logical code organization, and you can start thinking about how new code will affect loading and how you can help to decrease memory footprint. In the end, end users of your plugin will be glad to have better optimized plugin and that they don&#8217;t need to switch to more powerful server every time new WordPress is released.</p>
<p>Imagine now if every WordPress developer did the same thing as Matt did with Subscribe2? I don&#8217;t think that each plugin can see such gains in performance, but most optimizations can save 30-70% of memory. If you used 20 plugins that were not optimized, you can end up needing 70-90MB of PHP memory, and most shared hosting would have problems with that. If you have 20 optimized plugins, this number can drop to 45-55MB and that is another story, your server can handle more requests and will be faster.</p>
<p>I know of many developers that have used my optimization suggestions to make their plugins better, and in this case I am grateful that Matt decided to try optimization despite his skepticism of the process. And not only try, but get great results after. If you want to see if you can do better with your plugin performance, here is my tutorial on the subject: <a href="http://www.dev4press.com/2011/tutorials/wordpress/practical/how-to-optimize-plugin-loading/" target="_blank">How to optimize plugin loading</a>.</p>
<script src="http://feeds.feedburner.com/~s/adsense@gdragon.info?i=http://www.dev4press.com/2012/blog/benchmark/plugin-optimization-success-story-subscribe2/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://www.dev4press.com/2012/blog/benchmark/plugin-optimization-success-story-subscribe2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plugins performance testing: 2012 / January</title>
		<link>http://www.dev4press.com/2012/blog/benchmark/plugins-performance-testing-2012-january/</link>
		<comments>http://www.dev4press.com/2012/blog/benchmark/plugins-performance-testing-2012-january/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 17:00:21 +0000</pubDate>
		<dc:creator>MillaN</dc:creator>
				<category><![CDATA[Benchmark]]></category>
		<category><![CDATA[accurate resource usage]]></category>
		<category><![CDATA[complex implication]]></category>
		<category><![CDATA[different loading stages]]></category>
		<category><![CDATA[GD Press Tools]]></category>
		<category><![CDATA[grades]]></category>
		<category><![CDATA[historical data]]></category>
		<category><![CDATA[loading]]></category>
		<category><![CDATA[local server]]></category>
		<category><![CDATA[measurements]]></category>
		<category><![CDATA[monthly test]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[plugin code]]></category>
		<category><![CDATA[plugin configurations]]></category>
		<category><![CDATA[plugins snapshots]]></category>
		<category><![CDATA[resource usage]]></category>
		<category><![CDATA[server configuration]]></category>

		<guid isPermaLink="false">http://www.dev4press.com/?p=12577</guid>
		<description><![CDATA[This is first basic performance testing for WordPress plugins in 2012, and it will include 30 plugins. They will be tested on how much resources they use to load, and not to tell you if the plugin is good or not. Plugins features and plugin code quality is not the reviewed here.]]></description>
				<content:encoded><![CDATA[<p>This is first basic performance testing for WordPress plugins in 2012, and it will include 30 plugins. They will be tested on how much resources they use to load, and not to tell you if the plugin is good or not. Plugins features and plugin code quality is not the reviewed here.</p>
<p>Plan was to have more, but this first monthly measurement will have 30 instead of 50 plugins. But, this list will change over time, and new plugins will be added to the mix, and some of previously tested will be removed. But, from next month I will have publicly available table with all historical data for all tested versions.</p>
<blockquote><p><strong>All the data displayed here</strong> may vary depending on server configuration and other factors. Data here doesn&#8217;t say anything about quality of the plugins or their usability, it is only a test of resource usage. Also, some of the plugin can use different amount of resources depending on the plugin configuration, and all tests here are done with default plugin configurations. There is no way to test complex implication of different settings or method of work for a test like this.</p></blockquote>
<h3>Measurement Process</h3>
<p>For this first monthly test I have tested 30 plugins. All tests are done with a single installation, and WordPress 3.3 was used. Tests are done on the local server with PHP 5.3.8. All measurements are done using <a title="GD Press Tools Pro" href="http://www.dev4press.com/plugins/gd-press-tools/" target="_blank">GD Press Tools Pro 4.3.2</a> plugin. Plugin has a tracker class that can be loaded from wp-config.php file to accurately capture snapshots of different loading stages (among other things). To allow capturing plugins snapshots, I made small change to WordPress core files: added snapshot call into loop that loads plugins.</p>
<p>To get as accurate resource usage I spent some time testing each plugin individually to measure used memory during loading and after all plugins are loaded. Some plugins load most of its files hooked to WordPress action, and not during loading of the plugin. Again, this number is not 100% accurate, but it is very close. As these tests are improved over the next few months, the numbers can vary a bit.</p>
<h3>Plugin Grading</h3>
<p>Each plugin is graded on a scale from 1 (worst loading optimization) to 5 (best loading optimization). This grade is not only connected to used resources, but to actual method of loading plugin uses. Plugins that got grade 1 have no loading optimization and they always load everything (or almost everything) and that uses precious server resources always, even if the plugin doesn&#8217;t need all things loaded. There is no perfect loading method, because it would be very complicated to do. But grade 5 goes to plugins that use loading optimization, that care about what WordPress is executing, and how much resources are used actually. Change column for this first test is empty (well it is set to =), and it will change with next test depending on the progress plugin developers do with their plugins.</p>
<p>To give plugin a grade, I have analyzed plugin loading process and I have taken into account how much resources plugin takes due to loading method it uses. Best loading optimized plugin I know is my own GD Press Tools Pro. If this plugin is to load all its parts always it would use twice as much memory and it would need much more time to load. Even with all that, I always work on further changing how the plugin loads trying to make it better. Plugins close or better to the level of optimization in GD Press Tools Pro will be graded 5 also. If the plugin uses different amount of memory on front and back end it doesn&#8217;t mean that the grade will be higher because of that.</p>
<blockquote><p>Before we go on to the testing, read the original article from last month regarding the plugin loading process that will give the reasons for such testing and why it is important to make sure that plugin loads parts it needs only for admin side and front end: <a href="http://www.dev4press.com/2011/blog/benchmark/measuring-impact-of-plugins-on-wordpress-loading/" target="_blank">Measuring impact of plugins on WordPress loading</a>.</p></blockquote>
<h3>Tested plugins basic information</h3>
<p>30 tested plugins are listed in the table below. Beside basic data in first 5 columns, you can see if plugin adds own JavaScript, how many AJAX handlers uses, how many cron jobs can be registered by this plugin (it doesn&#8217;t mean that all will be registered always) and how many widgets plugin can add.</p>
<table class="d4ptable d4ppluginsinfo">
<thead>
<tr>
<th>Plugin</th>
<th>Free</th>
<th>Version</th>
<th>Released</th>
<th>Website</th>
<th>JavaScript</th>
<th>Ajax</th>
<th>Crons</th>
<th>Widgets</th>
</tr>
</thead>
<tbody>
<tr>
<td>Adminimize</td>
<td>Yes</td>
<td>1.7.24</td>
<td>2011.12.19.</td>
<td><a href="http://bueltge.de/wordpress-admin-theme-adminimize/674/" target="_blank">Home</a></td>
<td>Yes</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>All In One SEO Pack</td>
<td>Yes</td>
<td>1.6.13.8</td>
<td>2011.12.10.</td>
<td><a href="http://michaeltorbert.com/" target="_blank">Home</a></td>
<td>Yes</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>Antispam Bee</td>
<td>Yes</td>
<td>2.3</td>
<td>2011.12.23.</td>
<td><a href="http://antispambee.com/" target="_blank">Home</a></td>
<td>Yes</td>
<td>0</td>
<td>1</td>
<td>0</td>
</tr>
<tr>
<td>BackWPUp</td>
<td>Yes</td>
<td>2.1.7</td>
<td>2011.12.16.</td>
<td><a href="http://backwpup.com/" target="_blank">Home</a></td>
<td>Yes</td>
<td>7</td>
<td>2</td>
<td>0</td>
</tr>
<tr>
<td>bbPress</td>
<td>Yes</td>
<td>2.0.2</td>
<td>2011.11.28.</td>
<td><a href="http://bbpress.org/" target="_blank">Home</a></td>
<td>Yes</td>
<td>2</td>
<td>0</td>
<td>5</td>
</tr>
<tr>
<td>Contact Form 7</td>
<td>Yes</td>
<td>3.0.2.1</td>
<td>2011.12.18.</td>
<td><a href="http://contactform7.com/" target="_blank">Home</a></td>
<td>Yes</td>
<td>*</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>Events Manager</td>
<td>Yes</td>
<td>5.0.1</td>
<td>2012.01.02.</td>
<td><a href="http://wp-events-plugin.com/" target="_blank">Home</a></td>
<td>Yes</td>
<td>2</td>
<td>0</td>
<td>3</td>
</tr>
<tr>
<td>FPW Category Thumbnails</td>
<td>Yes</td>
<td>1.4.2</td>
<td>2012.01.02.</td>
<td><a href="http://fw2s.com/" target="_blank">Home</a></td>
<td>Yes</td>
<td>1</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>FPW Post Instructions</td>
<td>Yes</td>
<td>1.2.3</td>
<td>2012.01.02.</td>
<td><a href="http://fw2s.com/" target="_blank">Home</a></td>
<td>Yes</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>GD Affiliate Center Pro</td>
<td>No</td>
<td>1.3.8</td>
<td>2011.12.31.</td>
<td><a href="http://www.dev4press.com/plugins/gd-affiliate-center/" target="_blank">Home</a></td>
<td>Yes</td>
<td>0</td>
<td>3</td>
<td>1</td>
</tr>
<tr>
<td>GD bbPress Attachments</td>
<td>Yes</td>
<td>1.5.3</td>
<td>2011.12.28.</td>
<td><a href="http://www.dev4press.com/plugins/gd-bbpress-attachments/" target="_blank">Home</a></td>
<td>Yes</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>GD Custom Posts And Taxonomies Tools Lite</td>
<td>Yes</td>
<td>1.5.0</td>
<td>2011.12.28.</td>
<td><a href="http://www.dev4press.com/plugins/gd-taxonomies-tools/" target="_blank">Home</a></td>
<td>Yes</td>
<td>0</td>
<td>0</td>
<td>2</td>
</tr>
<tr>
<td>GD Custom Posts And Taxonomies Tools Pro</td>
<td>No</td>
<td>3.5.6</td>
<td>2011.12.29.</td>
<td><a href="http://www.dev4press.com/plugins/gd-taxonomies-tools/" target="_blank">Home</a></td>
<td>Yes</td>
<td>12</td>
<td>0</td>
<td>3</td>
</tr>
<tr>
<td>GD Press Tools Pro</td>
<td>No</td>
<td>4.3.2</td>
<td>2011.12.28.</td>
<td><a href="http://www.dev4press.com/plugins/gd-press-tools/" target="_blank">Home</a></td>
<td>Yes</td>
<td>30</td>
<td>7</td>
<td>0</td>
</tr>
<tr>
<td>GD Unit Converter</td>
<td>Yes</td>
<td>1.1.1</td>
<td>2011.12.12.</td>
<td><a href="http://www.dev4press.com/plugins/gd-unit-converter/" target="_blank">Home</a></td>
<td>Yes</td>
<td>1</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>Gravity Forms</td>
<td>No</td>
<td>1.6.2</td>
<td>2011.12.04.</td>
<td><a href="http://www.gravityforms.com/" target="_blank">Home</a></td>
<td>Yes</td>
<td>17</td>
<td>0</td>
<td>1</td>
</tr>
<tr>
<td>JigoShop</td>
<td>Yes</td>
<td>0.9.9.3.1</td>
<td>2011.12.28.</td>
<td><a href="http://jigoshop.com/" target="_blank">Home</a></td>
<td>Yes</td>
<td>7</td>
<td>1</td>
<td>8</td>
</tr>
<tr>
<td>Lightbox Plus</td>
<td>Yes</td>
<td>2.4.6</td>
<td>2012.01.01.</td>
<td><a href="http://www.23systems.net/plugins/lightbox-plus/" target="_blank">Home</a></td>
<td>Yes</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>MarketPress Lite</td>
<td>Yes</td>
<td>2.4.2</td>
<td>2011.12.17.</td>
<td><a href="http://premium.wpmudev.org/project/e-commerce-lite/" target="_blank">Home</a></td>
<td>Yes</td>
<td>3</td>
<td>0</td>
<td>4</td>
</tr>
<tr>
<td>Members</td>
<td>Yes</td>
<td>0.2</td>
<td>2011.06.13.</td>
<td><a href="http://justintadlock.com/archives/2009/09/17/members-wordpress-plugin/" target="_blank">Home</a></td>
<td>Yes</td>
<td>0</td>
<td>0</td>
<td>2</td>
</tr>
<tr>
<td>NextGEN Gallery</td>
<td>Yes</td>
<td>1.9.1</td>
<td>2011.12.10.</td>
<td><a href="http://alexrabe.de/?page_id=80" target="_blank">Home</a></td>
<td>Yes</td>
<td>10</td>
<td>0</td>
<td>3</td>
</tr>
<tr>
<td>Smart Youtube PRO</td>
<td>Yes</td>
<td>4.0.3</td>
<td>2011.12.09.</td>
<td><a href="http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube/" target="_blank">Home</a></td>
<td>Yes</td>
<td>0</td>
<td>0</td>
<td>1</td>
</tr>
<tr>
<td>Subscribe to Comments Reloaded</td>
<td>Yes</td>
<td>2.0.2</td>
<td>2011.08.31.</td>
<td><a href="http://wordpress.org/extend/plugins/subscribe-to-comments-reloaded/" target="_blank">Home</a></td>
<td>No</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>Subscribe2</td>
<td>Yes</td>
<td>7.0.1</td>
<td>2011.12.14.</td>
<td><a href="http://subscribe2.wordpress.com/" target="_blank">Home</a></td>
<td>Yes</td>
<td>0</td>
<td>0</td>
<td>2</td>
</tr>
<tr>
<td>SyntaxHighlighter Evolved</td>
<td>Yes</td>
<td>3.1.3</td>
<td>2011.11.17.</td>
<td><a href="http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/" target="_blank">Home</a></td>
<td>Yes</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>TinyMCE Advanced</td>
<td>Yes</td>
<td>3.4.5</td>
<td>2011.12.12.</td>
<td><a href="http://www.laptoptips.ca/projects/tinymce-advanced/" target="_blank">Home</a></td>
<td>Yes</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>W3 Total Cache</td>
<td>Yes</td>
<td>0.9.2.4</td>
<td>2011.08.26.</td>
<td><a href="http://www.w3-edge.com/wordpress-plugins/w3-total-cache/" target="_blank">Home</a></td>
<td>Yes</td>
<td>0</td>
<td>8</td>
<td>0</td>
</tr>
<tr>
<td>WooCommerce</td>
<td>Yes</td>
<td>1.3.2.1</td>
<td>2011.12.15.</td>
<td><a href="http://www.woothemes.com/woocommerce/" target="_blank">Home</a></td>
<td>Yes</td>
<td>17</td>
<td>0</td>
<td>14</td>
</tr>
<tr>
<td>WordPress SEO by Yoast</td>
<td>Yes</td>
<td>1.1.2</td>
<td>2011.12.16.</td>
<td><a href="http://yoast.com/wordpress/seo/" target="_blank">Home</a></td>
<td>Yes</td>
<td>4</td>
<td>1</td>
<td>0</td>
</tr>
<tr>
<td>WP e-Commerce</td>
<td>Yes</td>
<td>3.8.7.4</td>
<td>2011.12.08.</td>
<td><a href="http://getshopped.org/" target="_blank">Home</a></td>
<td>Yes</td>
<td>7</td>
<td>1</td>
<td>8</td>
</tr>
</tbody>
</table>
<p>All tested plugins, but one, used the internal WordPress AJAX handling. Contact Form 7 uses own handler and that is not something I can recommend. Using WP handler is best solution considering that it is already written with security concerns in mind and it is very easy to use, making plugin fit better with WP development concepts.</p>
<h3>Resource Usage Test Results</h3>
<p>Here is the list of all plugins in this test, and the results.</p>
<table class="d4ptable d4ppluginsmonthly">
<thead>
<tr>
<th></th>
<th colspan="4">Administration</th>
<th colspan="4">Frontend</th>
<th colspan="2">Grade</th>
</tr>
<tr>
<th>Plugin</th>
<th>Mem.</th>
<th>SQL</th>
<th>Time</th>
<th>Hooks</th>
<th>Mem.</th>
<th>SQL</th>
<th>Time</th>
<th>Hooks</th>
<th>Change</th>
<th>Grade</th>
</tr>
</thead>
<tbody>
<tr>
<td>Adminimize</td>
<td>0.8</td>
<td>0</td>
<td>0.015</td>
<td>9</td>
<td>0.8</td>
<td>0</td>
<td>0.014</td>
<td>9</td>
<td>=</td>
<td>2</td>
</tr>
<tr>
<td>All In One SEO Pack</td>
<td>0.5</td>
<td>1</td>
<td>0.011</td>
<td>12</td>
<td>0.5</td>
<td>1</td>
<td>0.011</td>
<td>12</td>
<td>=</td>
<td>3</td>
</tr>
<tr>
<td>Antispam Bee</td>
<td>0.3</td>
<td>1</td>
<td>0.004</td>
<td>2</td>
<td>0.2</td>
<td>0</td>
<td>0.004</td>
<td>6</td>
<td>=</td>
<td>3</td>
</tr>
<tr>
<td>BackWPUp</td>
<td>0.4</td>
<td>0</td>
<td>0.006</td>
<td>9</td>
<td>0.5</td>
<td>0</td>
<td>0.007</td>
<td>9</td>
<td>=</td>
<td>4</td>
</tr>
<tr>
<td>bbPress</td>
<td>4</td>
<td>0</td>
<td>0.056</td>
<td>216</td>
<td>3.8</td>
<td>0</td>
<td>0.046</td>
<td>205</td>
<td>=</td>
<td>1</td>
</tr>
<tr>
<td>Contact Form 7</td>
<td>0.4</td>
<td>0</td>
<td>0.009</td>
<td>17</td>
<td>0.5</td>
<td>0</td>
<td>0.007</td>
<td>16</td>
<td>=</td>
<td>2</td>
</tr>
<tr>
<td>Events Manager</td>
<td>5</td>
<td>2</td>
<td>0.07</td>
<td>75</td>
<td>3.7</td>
<td>2</td>
<td>0.052</td>
<td>64</td>
<td>=</td>
<td>2</td>
</tr>
<tr>
<td>FPW Category Thumbnails</td>
<td>0.3</td>
<td>1</td>
<td>0.004</td>
<td>9</td>
<td>0.3</td>
<td>1</td>
<td>0.004</td>
<td>1</td>
<td>=</td>
<td>3</td>
</tr>
<tr>
<td>FPW Post Instructions</td>
<td>0.1</td>
<td>0</td>
<td>0.003</td>
<td>7</td>
<td>0.1</td>
<td>0</td>
<td>0.003</td>
<td>1</td>
<td>=</td>
<td>4</td>
</tr>
<tr>
<td>GD Affiliate Center Pro</td>
<td>1.2</td>
<td>0</td>
<td>0.023</td>
<td>16</td>
<td>0.8</td>
<td>0</td>
<td>0.015</td>
<td>9</td>
<td>=</td>
<td>4</td>
</tr>
<tr>
<td>GD bbPress Attachments</td>
<td>0.2</td>
<td>0</td>
<td>0.005</td>
<td>1</td>
<td>0.2</td>
<td>0</td>
<td>0.004</td>
<td>1</td>
<td>=</td>
<td>3</td>
</tr>
<tr>
<td>GD Custom Posts And Taxonomies Tools Lite</td>
<td>1.5</td>
<td>0</td>
<td>0.019</td>
<td>13</td>
<td>1.3</td>
<td>0</td>
<td>0.016</td>
<td>7</td>
<td>=</td>
<td>4</td>
</tr>
<tr>
<td>GD Custom Posts And Taxonomies Tools Pro</td>
<td>2.3</td>
<td>0</td>
<td>0.033</td>
<td>49</td>
<td>1.6</td>
<td>0</td>
<td>0.025</td>
<td>24</td>
<td>=</td>
<td>4</td>
</tr>
<tr>
<td>GD Press Tools Pro</td>
<td>2.9</td>
<td>0</td>
<td>0.038</td>
<td>79</td>
<td>2</td>
<td>0</td>
<td>0.028</td>
<td>39</td>
<td>=</td>
<td>5</td>
</tr>
<tr>
<td>GD Unit Converter</td>
<td>0.5</td>
<td>0</td>
<td>0.011</td>
<td>4</td>
<td>0</td>
<td>0</td>
<td>0.001</td>
<td>0</td>
<td>=</td>
<td>5</td>
</tr>
<tr>
<td>Gravity Forms</td>
<td>2.9</td>
<td>0</td>
<td>0.03</td>
<td>4</td>
<td>2.9</td>
<td>0</td>
<td>0.027</td>
<td>4</td>
<td>=</td>
<td>2</td>
</tr>
<tr>
<td>JigoShop</td>
<td>3.6</td>
<td>0</td>
<td>0.059</td>
<td>148</td>
<td>2.8</td>
<td>0</td>
<td>0.044</td>
<td>105</td>
<td>=</td>
<td>1</td>
</tr>
<tr>
<td>Lightbox Plus</td>
<td>0.7</td>
<td>0</td>
<td>0.012</td>
<td>8</td>
<td>0.7</td>
<td>0</td>
<td>0.012</td>
<td>7</td>
<td>=</td>
<td>2</td>
</tr>
<tr>
<td>MarketPress Lite</td>
<td>2.4</td>
<td>0</td>
<td>0.026</td>
<td>44</td>
<td>2.4</td>
<td>0</td>
<td>0.027</td>
<td>44</td>
<td>=</td>
<td>1</td>
</tr>
<tr>
<td>Members</td>
<td>0.2</td>
<td>0</td>
<td>0.002</td>
<td>5</td>
<td>0.1</td>
<td>0</td>
<td>0.002</td>
<td>5</td>
<td>=</td>
<td>3</td>
</tr>
<tr>
<td>NextGEN Gallery</td>
<td>1.8</td>
<td>0</td>
<td>0.027</td>
<td>32</td>
<td>1.5</td>
<td>0</td>
<td>0.021</td>
<td>21</td>
<td>=</td>
<td>4</td>
</tr>
<tr>
<td>Smart Youtube PRO</td>
<td>0.7</td>
<td>0</td>
<td>0.014</td>
<td>10</td>
<td>0.6</td>
<td>0</td>
<td>0.007</td>
<td>10</td>
<td>=</td>
<td>3</td>
</tr>
<tr>
<td>Subscribe to Comments Reloaded</td>
<td>0.3</td>
<td>2</td>
<td>0.006</td>
<td>17</td>
<td>0.3</td>
<td>2</td>
<td>0.005</td>
<td>3</td>
<td>=</td>
<td>3</td>
</tr>
<tr>
<td>Subscribe2</td>
<td>1.3</td>
<td>0</td>
<td>0.014</td>
<td>2</td>
<td>1.3</td>
<td>0</td>
<td>0.012</td>
<td>2</td>
<td>=</td>
<td>1</td>
</tr>
<tr>
<td>SyntaxHighlighter Evolved</td>
<td>0.4</td>
<td>0</td>
<td>0.004</td>
<td>1</td>
<td>0.4</td>
<td>0</td>
<td>0.005</td>
<td>1</td>
<td>=</td>
<td>2</td>
</tr>
<tr>
<td>TinyMCE Advanced</td>
<td>0.9</td>
<td>0</td>
<td>0.011</td>
<td>13</td>
<td>0.9</td>
<td>0</td>
<td>0.012</td>
<td>13</td>
<td>=</td>
<td>3</td>
</tr>
<tr>
<td>W3 Total Cache</td>
<td>1.5</td>
<td>0</td>
<td>0.02</td>
<td>46</td>
<td>0.3</td>
<td>0</td>
<td>0.005</td>
<td>19</td>
<td>=</td>
<td>5</td>
</tr>
<tr>
<td>WooCommerce</td>
<td>3.2</td>
<td>0</td>
<td>0.056</td>
<td>100</td>
<td>3.4</td>
<td>0</td>
<td>0.051</td>
<td>134</td>
<td>=</td>
<td>1</td>
</tr>
<tr>
<td>WordPress SEO by Yoast</td>
<td>1.4</td>
<td>4</td>
<td>0.022</td>
<td>22</td>
<td>0.7</td>
<td>4</td>
<td>0.013</td>
<td>19</td>
<td>=</td>
<td>5</td>
</tr>
<tr>
<td>WP e-Commerce</td>
<td>1.3</td>
<td>0</td>
<td>0.019</td>
<td>47</td>
<td>1.3</td>
<td>0</td>
<td>0.019</td>
<td>47</td>
<td>=</td>
<td>2</td>
</tr>
</tbody>
</table>
<p>So, let&#8217;s start with the good. My GD Press Tools Pro is very fine tuned to load different plugin parts when needed, and it is always evolving and improving. GD Unit Converter on the original test was badly graded, but with latest version I have changed it all, and it graded 5.  W3 Total Cache has very good optimization of resource usage, and loads a lot of things when needed only. Loader maybe a too complicated for my taste, but it is effective. WordPress SEO by Yoast is a great example of well written and optimized plugin.</p>
<p>Plugins with potential to be better are many, and all grade 3 and 4 plugins fit into this group. NextGEN Gallery is almost there, and with a bit more work, it can go to grade 5. I plan to improve my own plugins further, and work on that is in progress for some of them, so I expect them to be improved in the next tests.</p>
<p>Grade 2 plugins have only some elements of optimization, but they are close to grade 1. Adminimize plugin shouldn&#8217;t even load on the front end except for some elements, and that needs to be optimized. Gravity Forms is a great plugin, that needs a long way to go but at least has some sort of loading control.</p>
<p>As for the grade 1 plugins, the results may be surprising considering how popular some of this plugins are. WooCommerce started from JigoShop, but almost nothing is done to change awful loader JigoShop has, so they are both graded 1. Mike Jolley from WooThemes told me that they are working on improving WooCommerce so, I am looking forward to that. bbPress also has no optimization at all, and even from latest sources for 2.1 I don&#8217;t see any improvements there, and that is not a good sign.</p>
<h3>Why is this all important?</h3>
<p>WordPress loads plugins on both admin side and front end. But, most plugins don&#8217;t need to behave same way in both cases. Many plugins are needed only on one side. So, a plugin can be used on admin side only, and has no use on the admin side. If the plugin is not optimize to load files only when needed, it will take same resources on front end also, even so it is not needed or used, and that is a waste of server memory and time to load. Most plugins have two parts, one to be used on admin side to set the plugin, and other that works on the front end. No need to load everything on both sides, load only what the plugin needs, and it will use least amount of memory and it will work faster.</p>
<p>Should you care? No. And yes. If you run few plugins, than amount of memory used is not that relevant. If you run your website on VPS or dedicated server, you have much more memory available, but if you are on the shared hosting, every MB can be critical (especially if the hosting company limits it). This test is not about plugin quality. If you prefer using All In One SEO, don&#8217;t let the lower grade be a big concern because WordPress SEO plugin got higher grade. This tests show how the plugin handle resources nothing more.</p>
<h3>Improving results</h3>
<p>I am sure that many developers will say that these results are not important, but considering that most of the WordPress users are on shared hosting with limited memory and resources available to them, this is most important thing to have plugins they need and still have server running fine. Same thing goes for themes also. Dev4Press website uses 20-21 plugins for the last year, but with theme (my xScape Theme Framework based) and my plugins optimizations, I managed to lower memory usage from 60M last January to 40M today.</p>
<p>I recommend to all plugin developers to read my tutorial: <a href="http://www.dev4press.com/2011/tutorials/wordpress/practical/how-to-optimize-plugin-loading/" target="_blank">How to optimize plugin loading</a>. Most of the things from it can be applied to all plugins, and all users will benefit from developers investing extra time to optimize own plugins.</p>
<hr />
<p><strong>Edit 2012.01.05.</strong> &#8211; Updated grade information.<strong><br />
Edit 2012.01.06.</strong> &#8211; Added few more explanations and link to original loading impact article.</p>
<script src="http://feeds.feedburner.com/~s/adsense@gdragon.info?i=http://www.dev4press.com/2012/blog/benchmark/plugins-performance-testing-2012-january/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://www.dev4press.com/2012/blog/benchmark/plugins-performance-testing-2012-january/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>How to optimize plugin loading</title>
		<link>http://www.dev4press.com/2011/tutorials/wordpress/practical/how-to-optimize-plugin-loading/</link>
		<comments>http://www.dev4press.com/2011/tutorials/wordpress/practical/how-to-optimize-plugin-loading/#comments</comments>
		<pubDate>Wed, 28 Dec 2011 13:50:07 +0000</pubDate>
		<dc:creator>MillaN</dc:creator>
				<category><![CDATA[Practical]]></category>
		<category><![CDATA[admin dashboard]]></category>
		<category><![CDATA[analysis]]></category>
		<category><![CDATA[benchmark article]]></category>
		<category><![CDATA[high-profile plugins]]></category>
		<category><![CDATA[impact]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[main plugin file]]></category>
		<category><![CDATA[maintenance]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[organization]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugin developers]]></category>
		<category><![CDATA[plugin loader]]></category>
		<category><![CDATA[plugins load]]></category>
		<category><![CDATA[resource usage]]></category>
		<category><![CDATA[shared hosting]]></category>
		<category><![CDATA[smaller plugins]]></category>
		<category><![CDATA[website loading]]></category>

		<guid isPermaLink="false">http://www.dev4press.com/?p=11877</guid>
		<description><![CDATA[Few weeks ago I have tested 35 plugins to find how they affect WordPress in terms of loading and resource usage. What can plugin author do to make plugin loading faster, to use less memory and to lower its impact on website loading? There are several things to consider.]]></description>
				<content:encoded><![CDATA[<p>Few weeks ago I have tested 35 plugins to find how they affect WordPress in terms of loading and resource usage. What can plugin author do to make plugin loading faster, to use less memory and to lower its impact on website loading? There are several things to consider.</p>
<blockquote><p><span style="color: #ff0000;"><strong>Notice:</strong></span> This tutorial is primarily for plugin developers, but it can be useful reading for anyone working with WordPress to better understand how plugins load and what can be done to improve it.</p></blockquote>
<h3>Intro</h3>
<p>Before we go on, I recommend you to take a look at the <a title="Measuring impact of plugins on WordPress loading" href="http://www.dev4press.com/2011/blog/benchmark/measuring-impact-of-plugins-on-wordpress-loading/" target="_blank">article with test results</a>. I know that many readers were surprised by the results, considering how some high-profile plugins scored very low and ended up in the bad optimized plugins category. Optimization will take these plugins one step further, showing that author cares about used resources (most WordPress websites are on shared hosting, and resources can be very limited), and that author understands that optimization is as important as adding features and making plugin look pretty.</p>
<p>So, what plugin authors can do to make their plugins better, how to optimize their loading, resource usage and with that speed? Before I list recommendations for this, here is a small analysis of how plugins are loaded.</p>
<h3>Plugins Loading</h3>
<p>One of the early steps in the WordPress loading is to load plugins. WordPress will get the list of all active plugins and it simply use PHP <strong>include</strong> function to load main plugin file. That main plugin file can contain the plugin (for smaller plugins or widgets), or it can be used as plugin loader to initialize plugin, or it can be the mix of the two. WordPress will do this for every single page, it will always include active plugins.</p>
<p>Even if the plugin is small, this can be an issue. For instance, my <a title="GD Unit Converter" href="http://www.dev4press.com/plugins/gd-unit-converter/" target="_blank">GD Unit Converter</a> plugin was used in the benchmark article. This plugin adds a widget on the admin dashboard, and that&#8217;s it. But, if you look at test results it was using 0.5MB on admin side and 0.4MB on the front end side. And it was doing nothing on front end side! So, I changed the main plugin file to act as a loader only. It will check if we are on admin side, and it will load another file that actually contains plugin. If we are on front end side, it will do nothing. After this optimization, on front end side plugin uses now 20KB, that is 95% memory saved. That is amazing gain, but you can&#8217;t expect such results for every plugin.</p>
<p>If you look at the test results again, even smallest plugins will use 0.4MB to 0.5MB. Imagine that you have 20 such plugins, and if all 20 of them save just 0.2MB, that will lower memory usage by 4MB, and will improve speed a bit. That might not look like a lot, but trust me, it will make a difference, especially for shared hosting websites.</p>
<p>Most plugins have a specific usage, and that requires plugin to be loaded only on some pages. In some cases you will need parts of the plugin functionalities loaded on every page. It can be very complicated to decide the need for plugin on each admin or front end page. But, you need to recognize what parts of the plugin are always needed, and what parts will be specific to some of the pages. That basic analysis will help you to decide what pieces of code go into separate files. If your plugin is only for the administration, it doesn&#8217;t need to be loaded on the front end. It is very simple to check this in the loader file and to prevent loading of the rest of the plugin.</p>
<p>If your plugin ads administration side pages or forms, you will need to load CSS styles or JavaScript files. Too many plugins these days are making a very big mistake of loading these files on every administration page without checking if the page belongs to the plugin. That will most likely break other plugins or change the styling for other plugins, or even WordPress. This is one of the things that must be optimized and done properly.</p>
<h3>Files and folders organization</h3>
<p>One of the most important things with any plugin, is organization of files and folders with code, CSS, images, JavaScript. When you make right structure for files and folders, you will make it easier to make future changes and perform maintenance.</p>
<ol>
<li>Code should be split into files according to functionalities. Many plugins don&#8217;t have that strict code separation, and they end up with large files with functions and classes thrown in. This makes later changes and maintenance harder, because code has no logical structure or order. Also, big files will use more memory, even if most of its functionality will not be used at all.
<p><div id="attachment_11978" class="wp-caption alignright" style="width: 134px"><img class="size-full wp-image-11978" title="Code Folders" src="http://cdn.dev4press.com/wp-content/uploads/2011/12/code_folder_strucutre.png" alt="Code Folders" width="124" height="198" /><p class="wp-caption-text">Code Folders</p></div></li>
<li>HTML forms should be separated from files with code. These forms will be loaded only on some pages, and they will contain mostly HTML markup code (they can contain PHP code, and usually do, but only used to fill HTML elements with data), and they should be kept outside of the main plugin code.</li>
<li>Create few folders for different files types for your plugin. Main plugin code should go in one folder, files with HTML forms should go into another folder, CSS styles and JavaScript should go in own folder and images should go in own folders. On the image on the right you can see a folder structure for one of my plugins. I like adding extra sub folders for &#8216;code&#8217; and &#8216;forms&#8217; depending on how many forms there are or how much code. In &#8216;code&#8217; folder it is recommended to have another level of folders if you have a lot of files.</li>
<li>If you have a lot of JavaScript or CSS files, it is good to have source versions for them as well as minified versions. This way they will be lighter on load, and you will have source versions for debugging and development.</li>
</ol>
<h3>Preparing for Optimization</h3>
<p>To make the most of the loading process, you need to know what page are you on. Based on that you can perform different operation and load different files. Make sure you set a variable with the page file name or some other identification. On admin side, WordPress pages are identified by the file name loaded. Your own plugin pages can be identified by the &#8216;page&#8217; variable from the URL request . To get the name of the file, name of the page and more, you can use this code:</p>
<pre class="brush: php; title: ; notranslate">$_current_file = end(explode(&quot;/&quot;, $_SERVER[&quot;PHP_SELF&quot;]));
$_current_page = isset($_GET[&quot;page&quot;]) ?  $_GET[&quot;page&quot;] : &quot;&quot;;
$_doing_ajax = defined(&quot;DOING_AJAX&quot;) &amp;&amp; DOING_AJAX;
$_doing_cron = defined(&quot;DOING_CRON&quot;) &amp;&amp; DOING_CRON;</pre>
<p>Based on this values you can pretty much know exactly which page is loaded, and what you need from your plugin to load. This can be executed in the main/loader plugin file. I have added two more variables to determine if the page is loaded for AJAX handling or while doing Cron job.</p>
<h3>Optimization Recommendations</h3>
<p>Here are some of the important recommendations you should follow:</p>
<ol>
<li>Analyze your plugin code, and decide what you need loaded on admin side, what on front end, and what on both. When you do that, you can go further and decide what you need loaded on all admin pages, and what on some of them (your plugin panels). Based on that, you will end up with many smaller files. Make some convenient naming scheme so that you can easily find files and use them in loader.</li>
<li>Always use main plugin file as loader. Even for simple plugins, this is best solution because you will have easier time later to expand the plugin. Don&#8217;t keep any code that is used by the plugin there, only decide what parts of the plugin you need to load.</li>
<li>Try to use classes as much as you can. Also, try to have only one class in a file, or at least put classes that depend on each other in one file. Use some logical naming convention for files, so that name gives you quick association to the class inside. PHP can help you with auto loading of files based on the required class, and you can find more info on that at the end of this tutorial.</li>
<li>Separate all AJAX handling code into own file. When your plugin on the server-side needs to handle AJAX requests, don&#8217;t add all that into file that is always loaded. It is easy to decide if the WordPress is loading to handle AJAX request, and only then load AJAX handling file. This goes only if the AJAX is handled by the WordPress admin-ajax.php file.</li>
<li>Always handle all AJAX calls through WordPress <strong>admin-ajax.php</strong>. This will save you a lot of headaches, and it can be used for both front end and admin side. Making your own handler file for AJAX is never good idea. If you need help with using <strong>admin-ajax.php</strong>, here is a good post in the WordPress.org Codex on using <a href="http://codex.wordpress.org/AJAX_in_Plugins" target="_blank">AJAX in plugins</a>.</li>
<li>Separate all Cron jobs handling code into own file. Similar to AJAX handling, Cron jobs executions are run in own page/thread call, and you can always determine if that is the case. If you have cron jobs in your plugin, move all its handling functions and classes into files that will be loaded only when Cron job is executed.</li>
<li>Any other code elements that are needed for some panels only, or in some specific cases, keep in own file(s) and load them only when needed. This can be code that handles individual panels, AJAX handling, CRON handling, saving data&#8230; The better you identify what you need and make smaller files to load when needed, you will get better optimized files.</li>
<li>Handle all plugin settings through WordPress options database table through get_option/update_option functions (or get_site_option/update_site_option for multisite network wide settings). Never save individual settings as separate options, this can create a mess and will be hard to update and maintain. Put all your settings in one or more array&#8217;s (depending on the scope of settings you have). These settings are all loaded with a single SQL query when WordPress loads, and you have them ready when your plugin loads.</li>
</ol>
<h3>PHP Auto Loading</h3>
<p>PHP has several methods to trigger automatic loading of files, based on the required code. If you split your code into classes, you can set up autoload functions that will do loading of files based on the class name. This can be very good solution for a plugin that has many classes used as modules, or used only in some cases. It is recommended to have one class in one file. More info about this you can find here: <a href="http://php.net/manual/en/language.oop5.autoload.php" target="_blank">Autoloading Classes on PHP.net</a>. Comments on that page have some really great examples on how the auto loading works.</p>
<div id="attachment_12490" class="wp-caption alignleft" style="width: 310px"><a href="http://cdn.dev4press.com/wp-content/uploads/2011/12/gdpt_snapshots.png" rel="lightbox[11877]" title="GD Press Tools Pro Debugger: Snapshots"><img class="size-medium wp-image-12490" title="GD Press Tools Pro Debugger: Snapshots" src="http://cdn.dev4press.com/wp-content/uploads/2011/12/gdpt_snapshots-300x148.png" alt="GD Press Tools Pro Debugger: Snapshots" width="300" height="148" /></a><p class="wp-caption-text">GD Press Tools Pro Debugger: Snapshots</p></div>
<h3>Measuring the optimization</h3>
<p>My <a href="http://www.dev4press.com/plugins/gd-press-tools/" target="_blank">GD Press Tools Pro</a> plugin can be used to debug and track WordPress loading. Tracker in this plugin has functions you can use to create snapshots that will contain used memory, hooks, SQL queries and time. You can use these functions in your code to measure how much resources some are used during different stages in the loading process. Plugin has a lot of other things to help you debug the code, find errors, track loading, track WordPress query, enqueued scripts and styles and much more.</p>
<p>There are some other plugins you can use to debug WordPress, but no other plugin allows tracking of the loading and the level of detail as GD Press Tools has.</p>
<h3>Conclusion</h3>
<p>There are many things you can do to optimize your plugin to use less memory and to load faster, and to have less impact on overall loading of WordPress. This article doesn&#8217;t cover everything and you will not be able to use all the recommendations for every plugin. But, good analysis, good code splitting and loading and tracking your optimization progress will always give you good results. Better optimized plugin is later easier to support and expand.</p>
<script src="http://feeds.feedburner.com/~s/adsense@gdragon.info?i=http://www.dev4press.com/2011/tutorials/wordpress/practical/how-to-optimize-plugin-loading/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://www.dev4press.com/2011/tutorials/wordpress/practical/how-to-optimize-plugin-loading/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>GD Custom Posts And Taxonomies Tools 3.5.5 Pro</title>
		<link>http://www.dev4press.com/2011/blog/plugins-news/gd-custom-posts-and-taxonomies-tools-3-5-5-pro/</link>
		<comments>http://www.dev4press.com/2011/blog/plugins-news/gd-custom-posts-and-taxonomies-tools-3-5-5-pro/#comments</comments>
		<pubDate>Sun, 25 Dec 2011 18:25:10 +0000</pubDate>
		<dc:creator>MillaN</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[bbPress integration]]></category>
		<category><![CDATA[color picker]]></category>
		<category><![CDATA[date picker]]></category>
		<category><![CDATA[embedding]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[loading]]></category>
		<category><![CDATA[meta boxes]]></category>
		<category><![CDATA[new version]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[parent]]></category>
		<category><![CDATA[Plugin loading]]></category>
		<category><![CDATA[styling]]></category>
		<category><![CDATA[Taxonomies Tools]]></category>

		<guid isPermaLink="false">http://www.dev4press.com/?p=12503</guid>
		<description><![CDATA[This will be last version of GD Custom Posts And Taxonomies Tools Pro released in 2011. After new years, I will start working on next major 3.6 version that is targeting late January, early February release. 3.5.5 fixes some bugs and improves some bbPress integration features.]]></description>
				<content:encoded><![CDATA[<p>This will be last version of GD Custom Posts And Taxonomies Tools Pro released in 2011. After new years, I will start working on next major 3.6 version that is targeting late January, early February release. 3.5.5 fixes some bugs and improves some bbPress integration features.</p>
<div id="attachment_12541" class="wp-caption alignright" style="width: 238px"><a title="bbPress Embeded Advanced Controls" href="http://cdn.dev4press.com/wp-content/uploads/2011/12/gdcpt35_bbpress_embed.png" rel="lightbox"><img class="wp-image-12541" title="bbPress Embeded Advanced Controls" src="http://cdn.dev4press.com/wp-content/uploads/2011/12/gdcpt35_bbpress_embed-285x300.png" alt="bbPress Embeded Advanced Controls" width="228" height="240" /></a><p class="wp-caption-text">bbPress 2.0 Embeding: Advanced Controls</p></div>
<p>This new version continues with more optimization for plugin loading, and now we have another 10%-15% less memory used on admin side. Some minor optimization is done on the front-end to load plugin parts more selectively.  As for the bugs this version includes reported bugs fixed: saving and switching between full and simple edit modes for default post types and taxonomies, minor problems with hiding taxonomies meta boxes, minor styling issues with plugin editors and some issues with import and export of plugin settings.</p>
<p>For bbPress 2.0 plugin integration, you can specify the location in the forms where yo embed the selected metabox. Also, plugin can include CSS and JS for advanced controls for bbPress integration: color picker, date picker and number. Subforums can now inherit meta boxes set by parent forums. Integration works with the edit forms also, so all saved meta values can be edited.</p>
<blockquote><p><strong>Notice:</strong> Please, test all the changes and all the existing features to make sure that optimization done in this version didn&#8217;t broke anything. I have tested this version for couple of days, but with so many changes you never know what might be broken.</p></blockquote>
<p>As announced before, next major 3.6 version will include several important new features, and work on it will begin in late January.</p>
<blockquote><p><strong>GD Custom Posts And Taxonomies Tools Pro Overview:</strong><br />
<a href="http://www.dev4press.com/gd-custom-posts-and-taxonomies-tools/" target="_blank">http://www.dev4press.com/gd-custom-posts-and-taxonomies-tools/</a><br />
<strong>GD Custom Posts And Taxonomies Tools Pro Home Page:</strong><br />
<a href="http://www.dev4press.com/plugins/gd-taxonomies-tools/" target="_blank">http://www.dev4press.com/plugins/gd-taxonomies-tools/</a></p></blockquote>
<script src="http://feeds.feedburner.com/~s/adsense@gdragon.info?i=http://www.dev4press.com/2011/blog/plugins-news/gd-custom-posts-and-taxonomies-tools-3-5-5-pro/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://www.dev4press.com/2011/blog/plugins-news/gd-custom-posts-and-taxonomies-tools-3-5-5-pro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GD Unit Converter 1.1.0</title>
		<link>http://www.dev4press.com/2011/blog/plugins-news/gd-unit-converter-1-1-0/</link>
		<comments>http://www.dev4press.com/2011/blog/plugins-news/gd-unit-converter-1-1-0/#comments</comments>
		<pubDate>Sat, 10 Dec 2011 23:57:59 +0000</pubDate>
		<dc:creator>MillaN</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[conversion units]]></category>
		<category><![CDATA[GD Unit Converter]]></category>
		<category><![CDATA[loading]]></category>
		<category><![CDATA[minor revisions]]></category>
		<category><![CDATA[optimization]]></category>

		<guid isPermaLink="false">http://www.dev4press.com/?p=12039</guid>
		<description><![CDATA[After few minor revisions of the plugin, here is the 'major' update to 1.1.0. GD Unit Converter got many new conversion unites in the past couple of months, and this new version has been optimized to use less resources and not load at all on the front end side of the website.]]></description>
				<content:encoded><![CDATA[<p>After few minor revisions of the plugin, here is the &#8216;major&#8217; update to 1.1.0. GD Unit Converter got many new conversion units in the past couple of months, and this new version has been optimized to use less resources and not load at all on the front end side of the website.</p>
<p>Plugin now supports 16 different units, and more will come. But, in this version, plugin is only gone through optimization based on the <a title="Measuring impact of plugins on WordPress loading" href="http://www.dev4press.com/2011/blog/benchmark/measuring-impact-of-plugins-on-wordpress-loading/" target="_blank">plugin impact on WordPress</a> benchmark I did last week. So, now plugin is only loading on admin side.</p>
<p>You can download plugin for free from Dev4Press website, or from WordPress.org plugins repository.</p>
<blockquote><p><strong>Dev4Press Home</strong>: <a title="GD Unit Converter Home Page" href="http://www.dev4press.com/plugins/gd-unit-converter/" target="_blank">http://www.dev4press.com/plugins/gd-unit-converter/</a><br />
<strong>WordPress.org</strong>: <a title="GD Unit Converter on WordPress.org" href="http://wordpress.org/extend/plugins/gd-unit-converter/" target="_blank">http://wordpress.org/extend/plugins/gd-unit-converter/</a></p></blockquote>
<script src="http://feeds.feedburner.com/~s/adsense@gdragon.info?i=http://www.dev4press.com/2011/blog/plugins-news/gd-unit-converter-1-1-0/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://www.dev4press.com/2011/blog/plugins-news/gd-unit-converter-1-1-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Measuring impact of plugins on WordPress loading</title>
		<link>http://www.dev4press.com/2011/blog/benchmark/measuring-impact-of-plugins-on-wordpress-loading/</link>
		<comments>http://www.dev4press.com/2011/blog/benchmark/measuring-impact-of-plugins-on-wordpress-loading/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 17:30:12 +0000</pubDate>
		<dc:creator>MillaN</dc:creator>
				<category><![CDATA[Benchmark]]></category>
		<category><![CDATA[active plugins]]></category>
		<category><![CDATA[different loading stages]]></category>
		<category><![CDATA[GD Affiliate Center]]></category>
		<category><![CDATA[GD Press Tools]]></category>
		<category><![CDATA[GD Star Rating]]></category>
		<category><![CDATA[GD Unit Converter]]></category>
		<category><![CDATA[hooks]]></category>
		<category><![CDATA[hosting companies]]></category>
		<category><![CDATA[impact]]></category>
		<category><![CDATA[loader]]></category>
		<category><![CDATA[loading impact]]></category>
		<category><![CDATA[loading optimization]]></category>
		<category><![CDATA[measurement]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[plugins snapshots]]></category>
		<category><![CDATA[shared hosting]]></category>
		<category><![CDATA[WooCommerce]]></category>
		<category><![CDATA[WordPress SEO]]></category>
		<category><![CDATA[worst loading stats]]></category>
		<category><![CDATA[YOURLS]]></category>

		<guid isPermaLink="false">http://www.dev4press.com/?p=11630</guid>
		<description><![CDATA[One of the best things about WordPress are plugins. With plugins you can expand WordPress and make it into anything you need it to be. But, each plugin requires time for loading and processing and it takes up additional resources. How much exactly one plugin need?]]></description>
				<content:encoded><![CDATA[<p>One of the best things about WordPress are plugins. With plugins you can expand WordPress and make it into anything you need it to be. But, each plugin requires time for loading and processing and it takes up additional resources. How much exactly one plugin need?</p>
<h3>Measurement Process</h3>
<p>For this article I have tested 35 plugins. This includes both free and commercial plugins, big and small plugins and all of them are tested on the admin side and on the website frontend. All tests are done with a single installation, and WordPress 3.3 RC1 was used. Tests are done on the local server with PHP 5.3.8.</p>
<p>Testing exact impact of plugins on WordPress is not easy, since there are two things that happen during the loading process. First part is WordPress loading the plugin (using PHP <strong>include</strong> function). Second part is done through actions and filters added by plugin to WordPress during loading stage. First part is not to complicated to measure and that is what you have in the table below. Second part is very complicated to measure because it would need tracking of each action or filter executed. This second part is even more complex if you take into account that different actions and filters are executed only on some of the pages or panels.</p>
<p>All measurements are done using <a title="GD Press Tools Pro" href="http://www.dev4press.com/plugins/gd-press-tools/" target="_blank">GD Press Tools Pro 4.3.1</a> plugin. Plugin has a tracker class that can be loaded from wp-config.php file to accurately capture snapshots of different loading stages (among other things). To allow capturing plugins snapshots, I made small change to WordPress core files: added snapshot call into loop that loads plugins.</p>
<h3>Measurement Results</h3>
<p>35 tested plugins are listed in the table below. You can see how much memory each plugin needs during loading, how many SQL queries are run and how many hooks attached to WordPress, as well as the total time needed for this loading stage. All this is done on the admin side (dashboard) and on the frontend (home page).</p>
<table class="d4ptable d4ppluginsbench">
<thead>
<tr>
<th></th>
<th colspan="4">Administration</th>
<th colspan="4">Frontend</th>
</tr>
<tr>
<th>Plugin</th>
<th>Mem.</th>
<th>SQL</th>
<th>Time</th>
<th>Hooks</th>
<th>Mem.</th>
<th>SQL</th>
<th>Time</th>
<th>Hooks</th>
</tr>
</thead>
<tbody>
<tr>
<th>After The Deadline</th>
<td>0.1M</td>
<td>0</td>
<td>0.004</td>
<td>10</td>
<td>0.1M</td>
<td>0</td>
<td>0.005</td>
<td>10</td>
</tr>
<tr>
<th>Akismet</th>
<td>0.2M</td>
<td>2</td>
<td>0.006</td>
<td>19</td>
<td>0.1M</td>
<td>1</td>
<td>0.004</td>
<td>7</td>
</tr>
<tr>
<th>All In One SEO Pack</th>
<td>0.7M</td>
<td>1</td>
<td>0.010</td>
<td>12</td>
<td>0.7M</td>
<td>1</td>
<td>0.012</td>
<td>12</td>
</tr>
<tr class="opt-plus-one">
<th>Antispam Bee</th>
<td>0.3M</td>
<td>1</td>
<td>0.004</td>
<td>2</td>
<td>0.2M</td>
<td>0</td>
<td>0.005</td>
<td>6</td>
</tr>
<tr class="opt-plus-one">
<th>BackupBuddy</th>
<td>1.0M</td>
<td>1</td>
<td>0.099</td>
<td>30</td>
<td>0.6M</td>
<td>0</td>
<td>0.009</td>
<td>9</td>
</tr>
<tr class="opt-minus-one">
<th>BackupWP</th>
<td>0.5M</td>
<td>0</td>
<td>0.007</td>
<td>9</td>
<td>0.5M</td>
<td>0</td>
<td>0.008</td>
<td>9</td>
</tr>
<tr class="opt-minus-two">
<th>bbPress</th>
<td>4.0M</td>
<td>0</td>
<td>0.047</td>
<td>216</td>
<td>3.8M</td>
<td>0</td>
<td>0.061</td>
<td>205</td>
</tr>
<tr>
<th>Better WordPress Google<br />
XML Sitemaps</th>
<td>0.6M</td>
<td>2</td>
<td>0.010</td>
<td>12</td>
<td>0.7M</td>
<td>2</td>
<td>0.013</td>
<td>12</td>
</tr>
<tr class="opt-zero">
<th>Contact Form 7</th>
<td>0.5M</td>
<td>0</td>
<td>0.007</td>
<td>16</td>
<td>0.4M</td>
<td>0</td>
<td>0.008</td>
<td>16</td>
</tr>
<tr>
<th>Dev4Press Updater</th>
<td>0.3M</td>
<td>2</td>
<td>0.007</td>
<td>5</td>
<td>0.3M</td>
<td>2</td>
<td>0.010</td>
<td>5</td>
</tr>
<tr class="opt-minus-one">
<th>Events Manager</th>
<td>4.2M</td>
<td>1</td>
<td>0.051</td>
<td>60</td>
<td>3.0M</td>
<td>1</td>
<td>0.042</td>
<td>54</td>
</tr>
<tr class="opt-minus-one">
<th>gdHeadSpace 4</th>
<td>0.7M</td>
<td>1</td>
<td>0.013</td>
<td>20</td>
<td>0.7M</td>
<td>1</td>
<td>0.013</td>
<td>8</td>
</tr>
<tr class="opt-plus-two">
<th>GD Affiliate Center Pro</th>
<td>1.1M</td>
<td>0</td>
<td>0.017</td>
<td>16</td>
<td>0.7M</td>
<td>0</td>
<td>0.013</td>
<td>9</td>
</tr>
<tr>
<th>GD bbPress Attachments</th>
<td>0.2M</td>
<td>0</td>
<td>0.003</td>
<td>1</td>
<td>0.2M</td>
<td>0</td>
<td>0.004</td>
<td>1</td>
</tr>
<tr>
<th>GD Pages Navigator</th>
<td>0.5M</td>
<td>0</td>
<td>0.008</td>
<td>3</td>
<td>0.5M</td>
<td>0</td>
<td>0.009</td>
<td>3</td>
</tr>
<tr class="opt-plus-two">
<th>GD Press Tools Pro</th>
<td>2.9M</td>
<td>0</td>
<td>0.032</td>
<td>78</td>
<td>2M</td>
<td>0</td>
<td>0.027</td>
<td>38</td>
</tr>
<tr class="opt-minus-one">
<th>GD Products Center Pro</th>
<td>2.4M</td>
<td>0</td>
<td>0.029</td>
<td>28</td>
<td>2.2M</td>
<td>0</td>
<td>0.032</td>
<td>17</td>
</tr>
<tr class="opt-minus-two">
<th>GD Star Rating</th>
<td>3.8M</td>
<td>0</td>
<td>0.043</td>
<td>12</td>
<td>3.8M</td>
<td>0</td>
<td>0.047</td>
<td>14</td>
</tr>
<tr class="opt-plus-two">
<th>GD Custom Posts And<br />
Taxonomies Tools Pro</th>
<td>2.8M</td>
<td>0</td>
<td>0.039</td>
<td>61</td>
<td>1.7M</td>
<td>0</td>
<td>0.027</td>
<td>23</td>
</tr>
<tr class="opt-minus-one">
<th>GD Unit Converter</th>
<td>0.5M</td>
<td>0</td>
<td>0.007</td>
<td>4</td>
<td>0.4M</td>
<td>0</td>
<td>0.010</td>
<td>4</td>
</tr>
<tr class="opt-minus-one">
<th>GravityForms</th>
<td>2.9M</td>
<td>0</td>
<td>0.025</td>
<td>4</td>
<td>2.8M</td>
<td>0</td>
<td>0.030</td>
<td>4</td>
</tr>
<tr>
<th>JetPack</th>
<td>0.7M</td>
<td>0</td>
<td>0.008</td>
<td>5</td>
<td>0.7M</td>
<td>0</td>
<td>0.009</td>
<td>5</td>
</tr>
<tr>
<th>Lightbox Plus</th>
<td>0.7M</td>
<td>0</td>
<td>0.011</td>
<td>8</td>
<td>0.7M</td>
<td>0</td>
<td>0.013</td>
<td>7</td>
</tr>
<tr>
<th>Regenerate Thumbnails</th>
<td>0.1M</td>
<td>0</td>
<td>0.002</td>
<td>1</td>
<td>0.1M</td>
<td>0</td>
<td>0.002</td>
<td>1</td>
</tr>
<tr class="opt-minus-two">
<th>Subscribe2</th>
<td>1.4M</td>
<td>0</td>
<td>0.013</td>
<td>5</td>
<td>1.4M</td>
<td>0</td>
<td>0.016</td>
<td>5</td>
</tr>
<tr>
<th>Subscribe to Comments Reloaded</th>
<td>0.3M</td>
<td>2</td>
<td>0.005</td>
<td>17</td>
<td>0.3M</td>
<td>2</td>
<td>0.006</td>
<td>3</td>
</tr>
<tr>
<th>SyntaxHighlighter Evolved</th>
<td>0.3M</td>
<td>0</td>
<td>0.004</td>
<td>1</td>
<td>0.3M</td>
<td>0</td>
<td>0.005</td>
<td>1</td>
</tr>
<tr class="opt-minus-two">
<th>The Google+ plugin</th>
<td>1.6M</td>
<td>1</td>
<td>0.032</td>
<td>10</td>
<td>1.6M</td>
<td>1</td>
<td>0.032</td>
<td>6</td>
</tr>
<tr>
<th>TinyMCE Advanced</th>
<td>0.1M</td>
<td>0</td>
<td>0.002</td>
<td>13</td>
<td>0.1M</td>
<td>0</td>
<td>0.002</td>
<td>13</td>
</tr>
<tr class="opt-plus-two">
<th>W3 Total Cache</th>
<td>1.4M</td>
<td>0</td>
<td>0.019</td>
<td>46</td>
<td>0.2M</td>
<td>0</td>
<td>0.008</td>
<td>19</td>
</tr>
<tr class="opt-minus-two">
<th>WooCommerce</th>
<td>3.9M</td>
<td>0</td>
<td>0.056</td>
<td>164</td>
<td>3.7M</td>
<td>0</td>
<td>0.059</td>
<td>148</td>
</tr>
<tr class="opt-plus-two">
<th>WordPress Download Monitor</th>
<td>1.5M</td>
<td>1</td>
<td>0.036</td>
<td>7</td>
<td>1M</td>
<td>1</td>
<td>0.033</td>
<td>7</td>
</tr>
<tr class="opt-plus-two">
<th>WordPress SEO by Yoast</th>
<td>1.2M</td>
<td>4</td>
<td>0.018</td>
<td>21</td>
<td>0.7M</td>
<td>4</td>
<td>0.014</td>
<td>16</td>
</tr>
<tr class="opt-zero">
<th>WP e-Commerce</th>
<td>0.8M</td>
<td>1</td>
<td>0.012</td>
<td>5</td>
<td>0.9M</td>
<td>1</td>
<td>0.011</td>
<td>5</td>
</tr>
<tr class="opt-minus-two">
<th>YOURLS WordPress to Twitter</th>
<td>1.7M</td>
<td>0</td>
<td>0.022</td>
<td>60</td>
<td>1.5M</td>
<td>0</td>
<td>0.025</td>
<td>53</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>Average</th>
<th>1.3M</th>
<th>0.57</th>
<th>0.020</th>
<th>28</th>
<th>1.1M</th>
<th>0.49</th>
<th>0.018</th>
<th>22</th>
</tr>
<tr>
<th>Total</th>
<th>45.9M</th>
<th>20</th>
<th>0.708</th>
<th>981</th>
<th>38.6</th>
<th>17</th>
<th>0.624</th>
<th>755</th>
</tr>
</tfoot>
</table>
<p>This data can change depending on the page used to do the testing since plugins can loading different things based on the page. But, these numbers are good reference point to see how the loading of plugins affect the WordPress. Also, you can see on average (and total) how much each plugin adds to the WordPress loading. What each row color means:</p>
<table class="d4ptable d4ppluginsbench" style="border-bottom: 1px solid #ffffff;">
<tbody>
<tr class="opt-zero">
<th style="font-weight: bold; font-size: 1.3em;" rowspan="5">Colors:</th>
<td style="width: auto;">Average optimization results</td>
</tr>
<tr class="opt-minus-two">
<td style="width: auto;">Bad optimization results, must be improved</td>
</tr>
<tr class="opt-minus-one">
<td style="width: auto;">Not good, should be improved</td>
</tr>
<tr class="opt-plus-one">
<td style="width: auto;">Good optimization, some space for improvement</td>
</tr>
<tr class="opt-plus-two">
<td style="width: auto;">Excellent optimization results</td>
</tr>
</tbody>
</table>
<p>I have mentioned the second part of loading that happens after all plugins are loaded, and WordPress runs actions and filters after that. Table below shows the difference between the WordPress with 35 plugins and WordPress with no plugins. Before plugins loader results are same for clean WordPress and WordPress with plugins.</p>
<p>Interesting thing is that you can have all 35 plugins active, and I had some WordPress setups with more than 70 active plugins. But, be ready for the WordPress using much more resources. The more plugins you have active, the more server power is needed. Plugins will have negative impact on website speed. To fix that you must use a caching plugin (W3 Total Cache for caching pages and minify the JS and CSS files) and some sort of server based optimization (eAccelerate or similar extension for PHP).</p>
<p>Clean WordPress will work with 32MB set for PHP to use. You can have less, but some internal operations might need a bit more, so 32MB is safe minimal value. If you have a couple of plugins, 32MB should be enough. If you have more than 10 plugins, at least 64MB is needed. As you can see from this test, for 35 plugins I had here, you need more, and 96MB or 128MB is safe value. Some shared hosting companies will not let you have more than 64MB or 80MB, so you might have issues with many plugins if you are on some restrictive hosting companies. Consult hosting support to make sure you will get enough resources. You can use average values above to get some orientation value for memory needed.</p>
<table class="d4ptable d4ppluginsbench">
<thead>
<tr>
<th></th>
<th colspan="4">Administration</th>
<th colspan="4">Frontend</th>
</tr>
<tr>
<th>Test</th>
<th>Mem.</th>
<th>SQL</th>
<th>Time</th>
<th>Hooks</th>
<th>Mem.</th>
<th>SQL</th>
<th>Time</th>
<th>Hooks</th>
</tr>
</thead>
<tbody>
<tr>
<th>Clean WP: Before plugins loader</th>
<td>13.2M</td>
<td>1</td>
<td>0.146</td>
<td>344</td>
<td>13.1M</td>
<td>1</td>
<td>0.172</td>
<td>307</td>
</tr>
<tr>
<th>Clean WP: After plugins loader</th>
<td>4.7M</td>
<td>32</td>
<td>0.236</td>
<td>137</td>
<td>1.0M</td>
<td>20</td>
<td>0.121</td>
<td>43</td>
</tr>
<tr>
<th>Clean WP: Total loading results</th>
<td>17.9M</td>
<td>32</td>
<td>0.381</td>
<td>481</td>
<td>14.1M</td>
<td>21</td>
<td>0.121</td>
<td>350</td>
</tr>
<tr>
<th>WP with plugins: After plugins loader</th>
<td>23.0M</td>
<td>235</td>
<td>1.206</td>
<td>893</td>
<td>9.7M</td>
<td>183</td>
<td>0.575</td>
<td>305</td>
</tr>
<tr>
<th>WP with plugins: Total loading results</th>
<td>81.3M</td>
<td>255</td>
<td>2.055</td>
<td>2221</td>
<td>60.2M</td>
<td>200</td>
<td>1.354</td>
<td>1364</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>Total 35 Plugins Impact</th>
<th>63.4M</th>
<th>223</th>
<th>1.674</th>
<th>1740</th>
<th>46.1M</th>
<th>179</th>
<th>1.233</th>
<th>1014</th>
</tr>
</tfoot>
</table>
<h3>Optimization Analysis</h3>
<p>As you can see in the plugins table on the top, some plugins results are in different colors. Green colors are for plugins with good optimization, red colors are for plugins with bad optimization. Badly optimized plugins are always loading everything on front-end and on admin side and they take a lot of memory. Smaller plugins with less than 0.8MB of memory used are not a big problem and they usually can&#8217;t be much optimized considering number of plugin files.</p>
<p>Since most plugins are behaving different on admin side and front-end, they should be taking care of what will be loaded in both cases. Only files that are actually needed should be loaded. This is not always possible, but with little extra work, code can be separated to allow for better loading optimization. Considering how much memory some of the plugins use, it is essential to try and lower required resources. Most WordPress users are on shared hosting servers, and they need plugins that are optimized.</p>
<h4>The Bad</h4>
<p>Plugins with worst loading stats and worst optimization from this test are: bbPress, GD Star Rating, Subscribe2, The Google+ Plugin, WooCommerce and YOURLS WordPress to Twitter. bbPress should be loading parts of the plugin only when needed, considering that forum is usually separated from normal WP pages. You can have some core parts always loaded, but most things are not needed on every page. My own GD Star Rating is old plugin, and I made some optimizations in some versions, but I need to do more, and GD Star Rating 2.0 will be highly optimized to use resources. The Google+ Plugin loads many libraries that are not needed for the most part, and for a simple plugin that this should be, it uses a lot of memory. I can&#8217;t judge quality of WooCommerce plugin, but I couldn&#8217;t believe how bad loading for this plugin is, and its main file loads 32 other files always. I have noticed some other things done bad in this plugin only from first few files, but loading is really bad.</p>
<p>Few plugins are a bit better than this, and they have lighter red color: BackupWP, Events Manager, gdHeadSpace4, GD Products Center Pro, GD Unit Converter, GravityForms. BackupWP doesn&#8217;t need anything on front end but it still loads things always. Events Manager has some loading optimizations, but I see potential to make it much better. I have modded plugin into gdHeadSpace4 and I didn&#8217;t make changes in loading. This plugin doesn&#8217;t have big memory footprint, but some changes can be done. My GD Products Center Pro is still in beta, and I plan to finish loading optimization before releasing 1.0 version. Another of my plugin GD Unit Converter is 100% admin side plugin, yet some things are loaded always, and I will improve this soon. GravityForms requires a lot of things on both admin and front end side, but there are some things that can be optimized much better that they are now.</p>
<h4>The Good</h4>
<p>Contact Form 7 and WP e-Commerce could benefit from some minor changes, but they are good as far as optimization goes. Light green and good optimization is done with: Antispam Bee and BackupBuddy. BackupBuddy would benefit greatly with better main loader file that is now too big. With fragmentation of this file, will help with optimization further.</p>
<p>Best optimized plugins, considering plugin size and features are: GD Affiliate Center Pro, GD Press Tools Pro, GD Custom Posts And Taxonomies Tools Pro, W3 Total Cache, WordPress Download Monitor, WordPress SEO. My 3 Pro plugins all have advanced loaders and modular structure to load things need for admin side or front end. Even the code used for Ajax or saving data is separated and loaded only when needed. W3TC does a great job in loading of different plugin modules and same goes for WordPress SEO by Yoast has loader that loads different files on both sides, minimizing the impact on WordPress.</p>
<p>My GD Press Tools Pro and GD Custom Posts And Taxonomies Tools Pro can replace great many other plugins, and that alone can save you a lot of resources. If you can have 10 plugins and if each one uses 1.3MB on average, that is 13MB, you can replace with GD Press Tools Pro only (and it can replace much more than just 10, maybe 60 or more plugins), that will use only 2.9MB.</p>
<h3>Loading used in my plugins</h3>
<p>Process of loading for my GD Press Tools Pro plugin is controlled by main plugin file. First, it loads parts of gdr2 shared library (used by all my plugins). Public functions and classes are loaded next (they are used on both admin and front end side). Some parts of internal code are loaded next. Main plugin class is loaded after that, and this class is used to initialize the plugin and load plugin settings. Than, loader checks if its loaded on admin side. If it is, admin core class is loaded as well as some extra functions. And if the plugin is loaded to save settings or through AJAX call, it loads separate settings saving or AJAX classes. This all improves loading on front end side by some 30%. This loading method is changed over time, and I think that it works great right now.</p>
<h3>Two plugins I ALWAYS use</h3>
<p>I can&#8217;t imagine running WordPress website without my GD Press Tools Pro. It is truly ultimate administration plugin, and it does so many things that you simply need on any website: backup, sitemaps, SEO, optimization and integration&#8230; Second plugin is W3 Total Cache. Page caching, external files minify and support for CDN are something each website should use to improve website speed.</p>
<h3>Cached Pages</h3>
<p>If you use W3 Total Cache or some other similar caching plugin, and you have page cache enabled, it is important to know that when cached page is served to a visitor, WordPress (and plugins) are not loaded at all. All these tests are made when there is no page caching active.</p>
<h3>Conclusion</h3>
<p>As you can see, plugins can have big impact on WordPress. While you can have as many plugins as you like, there are things to consider:</p>
<ul>
<li><strong>Compatibility</strong>: the more plugins you have, there is more chance to have some of them causing problems. Always test plugins when adding new plugin, it is rare, but it can happen. I always have local copies of all my websites, and when new things are added, I always test locally before moving to live server.</li>
<li><strong>Resources</strong>: the more plugins you have, the more server resources will be used. If you are on the shared hosting, I recommend that you review if you really need all plugins you might have already. Test different plugins you can use, because with too many of them active, you can easily hit the limits imposed by your hosting company. My <a title="GD Press Tools Pro" href="http://www.dev4press.com/plugins/gd-press-tools/" target="_blank">GD Press Tools Pro</a> can do many things, one of them is to measure data like this, and you can see exact impact of a new plugin added on memory, mySQL server or WordPress.</li>
<li><strong>Loading Speed</strong>: more plugins == less speed. It is very important to use cache plugins to optimize front end loading, to minify external files and use CDN to load external resources.</li>
</ul>
<p>I hope that other plugin developers will consider the results from this article, and my recommendations to improve loading for own plugins to optimize them so that end users get faster plugins that are not needing too much resources. Lets make plugins even better.</p>
<script src="http://feeds.feedburner.com/~s/adsense@gdragon.info?i=http://www.dev4press.com/2011/blog/benchmark/measuring-impact-of-plugins-on-wordpress-loading/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://www.dev4press.com/2011/blog/benchmark/measuring-impact-of-plugins-on-wordpress-loading/feed/</wfw:commentRss>
		<slash:comments>87</slash:comments>
		</item>
		<item>
		<title>GD Press Tools 3.1 Pro / 2.4 Lite</title>
		<link>http://www.dev4press.com/2010/blog/plugins-news/gd-press-tools-3-1-pro-2-4-lite/</link>
		<comments>http://www.dev4press.com/2010/blog/plugins-news/gd-press-tools-3-1-pro-2-4-lite/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 14:50:10 +0000</pubDate>
		<dc:creator>MillaN</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[backup method]]></category>
		<category><![CDATA[backup tools]]></category>
		<category><![CDATA[cleanup tools]]></category>
		<category><![CDATA[database backup]]></category>
		<category><![CDATA[database tools]]></category>
		<category><![CDATA[GD Press Tools]]></category>
		<category><![CDATA[jobs]]></category>
		<category><![CDATA[minor typos]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[optimize]]></category>
		<category><![CDATA[php functions]]></category>
		<category><![CDATA[prerequisites]]></category>
		<category><![CDATA[press tools]]></category>
		<category><![CDATA[repair options]]></category>
		<category><![CDATA[sending email]]></category>
		<category><![CDATA[version database]]></category>
		<category><![CDATA[windows servers]]></category>

		<guid isPermaLink="false">http://www.dev4press.com/?p=1375</guid>
		<description><![CDATA[It was awhile since the last update, and again both Pro and Lite editions are updated. 3.1 Pro got many more new tools and much improved database backup tools. Both versions feature many fixes and new user level settings for controlling plugin access for different user types.]]></description>
				<content:encoded><![CDATA[<p>It was awhile since the last update, and again both Pro and Lite editions are updated. 3.1 Pro got many more new tools and much improved database backup tools. Both versions feature many fixes and new user level settings for controlling plugin access for different user types.</p>
<p>Pro version Database tools are updated and expanded. Now, for each table you have optimize and repair options. Also, cleanup tools is split into two: one for optimization of database only, and other for repair. Sending email after backup is fixed, with few minor typos and errors displaying list of backups.</p>
<p>Most important new addition here is use of <strong>mysqldump</strong> program to create backups of the database. For this to work, plugin needs access to mysql program and also some PHP functions. New mySQL panel on Database panel is there to set and check all prerequisites. For manual and schedule backup jobs you can choose which backup method to use. If the mysqldump can&#8217;t be run, classic method will be used. Also, GZIP mysqldump method can&#8217;t be used on Windows servers.</p>
<p>Also, both versions are now fully compatible with latest build of WordPress 3.0.</p>
<p>After this, next step is to add sending backup archives via email and to add restore options for archived database files.</p>
<script src="http://feeds.feedburner.com/~s/adsense@gdragon.info?i=http://www.dev4press.com/2010/blog/plugins-news/gd-press-tools-3-1-pro-2-4-lite/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://www.dev4press.com/2010/blog/plugins-news/gd-press-tools-3-1-pro-2-4-lite/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Dev4Press moving to a cloud</title>
		<link>http://www.dev4press.com/2010/blog/website-news/dev4press-moving-to-a-cloud/</link>
		<comments>http://www.dev4press.com/2010/blog/website-news/dev4press-moving-to-a-cloud/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 02:49:25 +0000</pubDate>
		<dc:creator>MillaN</dc:creator>
				<category><![CDATA[Website]]></category>
		<category><![CDATA[available memory]]></category>
		<category><![CDATA[bandwith]]></category>
		<category><![CDATA[cache settings]]></category>
		<category><![CDATA[cpu speed]]></category>
		<category><![CDATA[dns servers]]></category>
		<category><![CDATA[high speeds]]></category>
		<category><![CDATA[hosting solution]]></category>
		<category><![CDATA[hosting system]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[minimal downtime]]></category>
		<category><![CDATA[old server]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[reliability]]></category>
		<category><![CDATA[scalability]]></category>
		<category><![CDATA[server response time]]></category>
		<category><![CDATA[tunning]]></category>

		<guid isPermaLink="false">http://www.dev4press.com/?p=1343</guid>
		<description><![CDATA[It's time to move on. Current hosting solution is simply not enough any more to host Dev4Press and our other websites. So, the decision is made to find better hosting that will allow scalability and reliability needed to ensure minimal downtime and high speeds.]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s time to move on. Current hosting solution is simply not enough any more to host Dev4Press and our other websites. So, the decision is made to find better hosting that will allow scalability and reliability needed to ensure minimal downtime and high speeds.</p>
<p>And, the solution is found in VPS.NET cloud hosting. They offer scalable VPS servers with adjustable number of nodes to increase CPU speed, bandwith and available memory. To test the new hosting system, our website <a href="http://www.tvscape.net/" target="_blank"><strong>TVScape.NET</strong></a> has been transferred to new server yesterday. And the tests showed that TVScape is now 3 times faster (on average), then on old server. Response time is cut in half, and typical page with over 80 images fully loads in less then 15 seconds, while on old server same page needed 40 to 100 seconds. Also, new server is VPS and that allows fine tunning of cache settings, expiry of resources allowing much better optimization.</p>
<p>Dev4Press is moving to new server most likely next friday, so that the support and other normal functions of the website are not interrupted. In any case, there will be a notice announcing the exact period when the transfer is in progress. Major problem during the transfer will be DNS change that with some DNS servers can take up to 24 hours for new server IP to propagate. So, for a day website will work on both servers and depending on your location, you might get old or new website.</p>
<script src="http://feeds.feedburner.com/~s/adsense@gdragon.info?i=http://www.dev4press.com/2010/blog/website-news/dev4press-moving-to-a-cloud/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://www.dev4press.com/2010/blog/website-news/dev4press-moving-to-a-cloud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk: enhanced
Content Delivery Network via cdn.dev4press.com

 Served from: www.dev4press.com @ 2013-05-25 14:19:53 by W3 Total Cache -->