Skip to content

Perf/reorganize autoloading#62231

Draft
come-nc wants to merge 11 commits into
masterfrom
perf/reorganize-autoloading
Draft

Perf/reorganize autoloading#62231
come-nc wants to merge 11 commits into
masterfrom
perf/reorganize-autoloading

Conversation

@come-nc

@come-nc come-nc commented Jul 16, 2026

Copy link
Copy Markdown
Contributor
  • Resolves: #

Summary

The idea here is to have only one autoloader instead of one by application, with a cached classmap in a PHP file.
On a test instance (debug mode on) I get 500ms instead of 600ms to run occ status.
The cached array in PHP file mechanism could be leveraged for other optimizations.

TODO

  • Fix tests if needed
  • Remove debug output
  • Remove TODO comments
  • Clean up git history
  • Rework tooling related to autoloader (build/autoloadchecker.sh notably)
  • Document
  • Rename/move new classes to a namespace
  • Add tests for new classes
  • Move core and lib to PSR4 scanning
  • Remove parts of Autoloader we do not use (leftover from nette)
  • Test updates, app installs, app upgrades…
  • Figure out how to manage temp directory (default location, opcache config, deletion of old files, permissions, and so on)
  • Improve installation usecase (currently results in 26 disk scans because each app installation triggers one, and 26 files in cache afterwards)

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

come-nc added 5 commits July 16, 2026 11:13
This leverages opcache to be as fast as possible. Can be used for
 autoloading class maps, but also for other kind of pre-computed cached
 arrays (routes, occ commands, …).

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
The idea is to cache to disk a static classmap with all classes from
 core and applications.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
@come-nc come-nc self-assigned this Jul 16, 2026
Comment thread lib/private/Autoloader.php Fixed
Comment thread lib/private/Autoloader.php Fixed
come-nc added 6 commits July 16, 2026 13:55
cachedirectory still needs to be added to config.sample.php

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
There was a weird inconsistent mix of Test\, Tests\lib, Test\Core,
 Tests\Core and Core\.
Now there is only Test\ for tests/lib/ and Tests\Core for tests/Core.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
@icewind1991

Copy link
Copy Markdown
Member

(I'm very hesitant about this approach but don't really know how to formulate my reasoning, but leaving a note for a soft-disagreement until I can better word things or change my mind)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants