Performance improvements
-
Hello,
I’m noticing a large performance hit with this plugin. It seems spl_autoload_register in require_classes is looping through all of the classes on the site (on this particular site looping through 10,000 times) which results in almost 68,000 file_exists checks that run within this function.
Ideally this should be recoded to avoid loading the function more than is necessary however it’s mainly the file_exists check that is affecting performance.
Is it only the TagGroups_ classes that need to run the autoloader?
I have added a string check below so it exits early if the $class_name doesn’t contain TagGroups_ and it’s loading the same amount of PHP files so I assume this is ok?
public function require_classes() { spl_autoload_register( function ( $class_name ) { if (strpos($class_name, 'TagGroups_') === false) { return; }Would appreciate if you can look into this. It can be replicated on a fresh WP install.
The topic ‘Performance improvements’ is closed to new replies.