Optimize the autoloader when running Composer commands

Created on 15 March 2024, about 1 year ago
Updated 17 April 2024, about 1 year ago

Problem/Motivation

Automatic updates' package manager does not optimize the autoloader. This can result in a pretty big performance reduction, increasing runtimes by 30%+.

Proposed resolution

Add ''--optimize-autoloader" when requiring packages.

Feature request
Status

Fixed

Version

3.0

Component

Code

Created by

🇺🇸United States grasmash

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @grasmash
  • Merge request !1033You gotta optimize your autoloader, yo. → (Merged) created by grasmash
  • Pipeline finished with Failed
    about 1 year ago
    Total: 1284s
    #120440
  • Pipeline finished with Failed
    about 1 year ago
    Total: 1269s
    #120514
  • First commit to issue fork.
  • 🇺🇸United States tedbow Ithaca, NY, USA

    This looks good. Is there way we actually confirm this gives a performance boost. Running kernels tests that do run composer seem to take the same amount of time.

  • 🇺🇸United States grasmash

    The performance post depends completely on the application. It should be much faster for applications that have large number of dependencies, because optimizing the auto loader reduces disk reads during autoloading.

    This is the best practice recommended by composer itself for production applications. Also, don’t think there’s any downside to it. The only time that you should not optimize the auto loader is when you are working in a development environment, because the dynamic file discovery makes it easier during development to create new files, change names, etc., without having to dump the auto loader each time you make a change.

    See https://getcomposer.org/doc/articles/autoloader-optimization.md#:~:text=....

  • Status changed to RTBC about 1 year ago
  • 🇺🇸United States phenaproxima Massachusetts

    I agree with @grasmash here. There is no obvious downside to doing this. I think we should go for it - it's an easy, unobtrusive fix.

  • 🇺🇸United States phenaproxima Massachusetts
  • Pipeline finished with Skipped
    about 1 year ago
    #136543
  • Pipeline finished with Skipped
    about 1 year ago
    #136544
  • Status changed to Fixed about 1 year ago
  • 🇺🇸United States phenaproxima Massachusetts

    Merged into 3.0.x and cherry-picked to 3.1.x. Thanks!

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Pipeline finished with Failed
    18 days ago
    Total: 836s
    #498506
  • Pipeline finished with Failed
    17 days ago
    Total: 942s
    #499140
  • Pipeline finished with Failed
    17 days ago
    Total: 596s
    #499277
  • Pipeline finished with Canceled
    17 days ago
    Total: 227s
    #499310
  • Pipeline finished with Success
    17 days ago
    Total: 734s
    #499311
  • Pipeline finished with Failed
    13 days ago
    Total: 846s
    #502383
  • Pipeline finished with Canceled
    13 days ago
    Total: 99s
    #502399
  • Pipeline finished with Failed
    12 days ago
    Total: 702s
    #503099
  • Pipeline finished with Canceled
    12 days ago
    Total: 66s
    #503170
  • Pipeline finished with Success
    12 days ago
    Total: 850s
    #503217
  • Pipeline finished with Failed
    12 days ago
    Total: 657s
    #503246
  • Pipeline finished with Failed
    12 days ago
    Total: 1006s
    #503279
  • Pipeline finished with Success
    11 days ago
    Total: 868s
    #503926
Production build 0.71.5 2024