• Resolved Antony Booker

    (@antonynz)


    Hello,

    I’ve noticed a similar performance issue with the class autoloader in 4.3+, as reported previously.

    This time coming from the new extendify-sdk folder specifically:
    redux-framework/extendify-sdk/vendor/composer/ClassLoader.php:423

    Due to the way it’s loading that function via spl_autoload_register it’s looping over all the classes in the website. This results in thousands of file_exists checks however only 3 files appear to be loaded:
    extendify-sdk/vendor/composer/../../app/Admin.php
    extendify-sdk/vendor/composer/../../app/App.php
    extendify-sdk/vendor/composer/../../app/Plugin.php

    On one particular site 4.3 adds 40% to the backend time.

    Unfortunately I don’t think the previous class whitelisting condition will work as the autoloader is being requested by other plugins (such as woo-permalink-manager and woocommerce-paypal-payments) so it may need the namespace changed to be compatible with other plugins that use the composer autoload?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Kev Provance

    (@kprovance)

    I would recommend disabling the Extendify library. On the admin screen, click Tools, select Redux and click the Templates tab. Uncheck the Extendify library box.

    Thread Starter Antony Booker

    (@antonynz)

    Thanks for the reply. I have asked the composer team on github regarding the best practice for this and they recommended using authoritative autoloading as per https://getcomposer.org/doc/articles/autoloader-optimization.md#optimization-level-2-a-authoritative-class-maps

    This will set a classmap defining the location of all classes it handles, rather than looping through all classes.

    If you could please look into this for a future release it will be really appreciated as this can have a large impact on performance.

    Plugin Author kbatdorf

    (@kbat82)

    Hi @antonynz

    Can you link to the conversation on GitHub for context?

    > I would recommend disabling the Extendify library.

    This should stop the autoloader from even being invoked. Did you find any success disabling it?

    Thread Starter Antony Booker

    (@antonynz)

    Thanks for the reply. I had previously downgraded but disabling the Extendify Library under Settings > Redux worked on 4.3 to stop the performance impact of the autoloader.

    Here is the thread on Github:
    https://github.com/composer/composer/issues/10205#issuecomment-949387699

    Plugin Author kbatdorf

    (@kbat82)

    Thanks @antonynz

    Can you expound on how you identified this issue initially? I would like to reproduce it before making any changes.

    From that thread:

    And if you rely on the filesystem-based discovery (PSR-0 or PSR-4), the best practice is indeed to have a prefix as precise as possible

    We’re autoloading with PSR-4 so Composer should already know which files to look for and where. It should be scoped to the directory we define specifically. I believe they were assuming that we were running the install command from your main directory thus loading classes in a global context.

    If you could help me reproduce the inefficiency though we’ll have that updated asap.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Performance improvements’ is closed to new replies.