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

Performance: faster AopComposerLoader::findFile() for classes outside the cache (~1.6 µs per class)

Closed Beginner friendly
#732 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
php
Domain
performance

Research direction

Start in AopComposerLoader::findFile(), named in the issue, and follow it into Enumerator::getFilter() where the include/exclude closures and preg_match run. The proposed change is to pass the already resolved path, replace the SplFileInfo and realpath work with str_starts_with/str_ends_with checks, and compile the path filters into one regex when the enumerator is created. Done means the loader avoids the extra path resolution and per-path closure, with a before/after benchmark showing the ~1.6 µs per class reduction and no behavior change.

Written by the indexing model from the issue text.

Description

Enhancement Performance

Problem

Every class the woven-class cache doesn't know (vendor and framework classes) goes through AopComposerLoader::findFile(), which:

  • resolves the path with realpath,
  • creates a SplFileInfo that resolves the path a second time with getRealPath(),
  • runs one closure and one preg_match per include/exclude path inside array_any (Enumerator::getFilter).

Measurement

Warm opcache:

per class
plain composer 1.2–2.0 µs
with AopComposerLoader 2.8–5.3 µs
prototype fix (wrapper part only) 1.98 → 0.33 µs

Loading the ~21 framework classes a request needs takes 106 µs instead of 58 µs. An app loading 300 vendor classes per request pays about 0.7 ms extra.

Proposal

  • Pass the already resolved path along instead of building a SplFileInfo.
  • Check the .php extension and the app-dir prefix with string functions (str_starts_with, str_ends_with).
  • Compile the include and exclude paths into one regex each, once, when the enumerator is created.

Estimate

About −1.6 µs per class not in the cache, around −0.5 ms per request for a typical framework-based app. Low risk, small change.

Dominant language
PHP
Stars
1.7k
Forks
166
Avg merge
9h 50m
Merged PRs (30d)
30

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.