Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Performance: do not merge the woven class map into composer's class map (~260 µs with an optimized autoloader)

Open
#733 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
55/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
php
Domain
performance

Research direction

The loader is AopComposerLoader, with the relevant methods __construct and findFile(); start by reading __construct to see the addClassMap($this->classMap) call and how classMap is built. Then read composer's ClassLoader::addClassMap() and findFile() to understand the merge cost and the direct-findFile behaviour the Risk section flags. Make findFile() check $this->classMap[$class] before delegating, and run the autoloader tests to confirm woven and non-woven classes both still resolve. Done means the merge is gone without breaking direct findFile() callers.

Written by the indexing model from the issue text.

Description

Enhancement Performance To Be Discussed

Problem

In production, AopComposerLoader::__construct calls $original->addClassMap($this->classMap). Composer's addClassMap() runs array_merge over its whole class map. The cost depends on the size of the app's composer class map, not on how many classes are woven.

Measurement

With a 30k-entry optimized class map (composer dump-autoload -o, common in production), the merge costs about 260 µs and ~1 MB of memory per request (about 8.7 ns per entry).

Proposal

Drop the addClassMap() call. Look up $this->classMap[$class] first in AopComposerLoader::findFile(); this also skips composer's own lookup for woven classes.

Risk (why "To Be Discussed")

Code that calls composer's findFile() directly, for example via ClassLoader::getRegisteredLoaders() (some tools and frameworks do this), would get the original file for woven classes instead of the woven one. We need to decide whether that is acceptable or whether to keep a slower compatible mode as an option.

Estimate

Up to −260 µs per request for large apps with an optimized autoloader. Medium risk, small change.

Dominant language
PHP
Stars
1.7k
Forks
166
Avg merge
10h
Merged PRs (30d)
35

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from goaop/framework

All issues in goaop/framework

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.