-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Context
When PHPUnit handles deprecation warnings during test execution, the ErrorHandler uses SourceFilter::includes() to determine whether the deprecation was triggered in first-party code or third-party code (self, direct, or indirect).
As reported in #6111 and #6469, for example, some users are experience a significant performance degradation since issue trigger identification was introduced.
SourceMapper::map() is slow
SourceFilter::includes() uses a map that is generated by SourceMapper::map(). The latter scans the configured <source> directories to build a list of first-party files.
This file scanning operation can cause significant performance degradation, especially when:
- The
<source>include/exclude patterns are overly broad - The configured source directories contain many files
- Many deprecation warnings are triggered during a test run
SourceMapper::map() is called multiple times when process isolation is used
SourceMapper::map() is called only once per PHPUnit process. However, when tests are run in separate processes (--process-isolation CLI option, processIsolation="true" XML configuration file setting, or #[RunInSeparateProcess] and #[RunTestsInSeparateProcesses] attributes) then SourceMapper::map() performs the potentially expensive file scanning operation multiple times, once in the parent process and once in each child process.