Performance tweak
-
I used https://nintechnet.com/codeprofiler/ to analyse a site and noticed that this plugin had quite a big overhead compared to what functionality it brings to the table.
The analyser gave this feedback:
Why does Code Profiler warn me that I have multiple plugins using Composer?
Composer, a tool for dependency management in PHP, is included in many popular plugins and themes. It is used to autoload PHP classes.
Code Profiler will inform you if two or more activated plugins use it because you will need to take it into consideration when reading and interpreting the results. Let’s take an example:
Assuming you have four plugins, #1, #2, #3 and #4. Both plugins #1 and #4 include and require Composer. WordPress will start and load plugin #1, which will run an instance of Composer to load its classes. Immediately after, WordPress will load plugins #2 and #3. Then, it will load plugin #4, which too will need to load its classes. However, plugin #4 will not start a new instance of Composer but, instead, will rely on the one from plugin #1 to load its own classes.
As a result, the execution time of plugin #1 will increase (its instance of Composer is used to load classes for plugin #4 too), while the execution time of plugin #4 will decrease (it doesn’t need to start a new instance of Composer). Therefore, if you have a dozen or more plugins using Composer, it is important to take into consideration that the execution time of plugin #1 may be much higher than other plugins.
Also, assuming you are a developer and just want to profile a plugin that you wrote and that includes Composer, you will need to disable any other plugin using Composer in order to get the most accurate results for your plugin only.y does Code Profiler warn me that I have multiple plugins using Composer?Here are the result by just using an simple require.php which include the 3 files needed instead of using Composer.
Before:

After

It’s not much, but every performance tweak helps, hope you consider this tweak or have a little custom autoloader.
You must be logged in to reply to this topic.