Skip to content

PRESS7-21: Optimize Composer autoloading #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

bradp
Copy link
Contributor

@bradp bradp commented Feb 26, 2025

Proposed changes

Configures Composer to use APCu cache optimization for the autoloader.

On my local install the improvements were good but not amazing.

Before the change:
Screenshot 2025-02-26 at 8 57 48 AM

After the change:
image

For reference, using Authoritative class maps showed a small improvement, but not as much as APCu cache
Screenshot 2025-02-26 at 9 00 06 AM

However, on a Bluehost site the improvements are quite striking. The autolo

Before the change:
Screenshot 2025-02-26 at 9 15 04 AM

After the change:
Screenshot 2025-02-26 at 9 15 25 AM

Copy link
Member

@arunshenoy99 arunshenoy99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @bradp, based on the screenshots you provided, it looks like setting "apcu-autoloader": true in composer.json significantly increased execution time:

  • autoload_real.php: 0.014s → 0.333s (~22x increase)
  • ClassLoader.php: 0.078s → 0.186s (~2.4x increase)

We might want to double-check if APCu is actually helping in this case or if it’s introducing unnecessary overhead. Let me know if I’m missing something. Thanks!

@bradp
Copy link
Contributor Author

bradp commented Mar 11, 2025

Hey @bradp, based on the screenshots you provided, it looks like setting "apcu-autoloader": true in composer.json significantly increased execution time:

  • autoload_real.php: 0.014s → 0.333s (~22x increase)

  • ClassLoader.php: 0.078s → 0.186s (~2.4x increase)

We might want to double-check if APCu is actually helping in this case or if it’s introducing unnecessary overhead. Let me know if I’m missing something. Thanks!

The first screenshots are on my local, and you are correct; there was a decrease. However, take a look at the last 2 screenshots - those are on a Bluehost site and showed a pretty drastic improvement, both ClassLoader.php and autoload_real.php went to ~0.01 or less after the change.

@circlecube circlecube changed the base branch from main to develop March 12, 2025 18:10
@circlecube circlecube requested a review from wpscholar March 13, 2025 13:13
@circlecube
Copy link
Member

@bradp - Can we get the total load times for before and after this change on a bluehost production site? Broken down is nice too, but hard to tell a full picture with just the screenshots since some of them are cropped.

Copy link
Member

@arunshenoy99 arunshenoy99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran a few tests on a BH prod site, but I couldn't find a clear pattern indicating that this consistently reduces load time on the site. For example, in some cases, the load time actually increases, while in others, it decreases. But, I can't find a consistent trend nor a large change when I compare same files.

Before:
image

After:
image

We could consider getting help from QA to write an automation script that runs n samples or so on a prod site to see if we can identify a trend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants