Skip to content

Perf: Infer the datasets only of the static methods of test cases - #292

Merged
alies-dev merged 1 commit into
psalm:masterfrom
alies-dev:perf-provider-return-type
Nov 25, 2026
Merged

alies-dev merged 1 commit into
psalm:masterfrom
alies-dev:perf-provider-return-type

Conversation

@alies-dev

Copy link
Copy Markdown
Contributor

ProviderReturnTypeHandler walked the body of every static method with only a native return type, so it ran for almost every static helper of a project (fromId(): self, count(): int, rules(): array) and kept one inferred type per returned array element until the end of the run. The inferred datasets are only read for providers of the test case being analysed, so the handler now walks only methods of a test case, and trait methods as before. Reported issues are unchanged.

1 024 static helpers in application code with no tests, PHPUnit 13, --threads=1 --debug-performance, median of 3:

Return type of the helpers Before After
int 67 ms < 2 ms
array 77 ms < 2 ms

@alies-dev alies-dev self-assigned this Nov 25, 2026
@alies-dev
alies-dev marked this pull request as ready for review November 25, 2026 00:54
@alies-dev alies-dev changed the title Infer the datasets only of the static methods of test cases Perf: Infer the datasets only of the static methods of test cases Nov 25, 2026
@alies-dev
alies-dev merged commit e944ce9 into psalm:master Nov 25, 2026
8 checks passed
@alies-dev
alies-dev deleted the perf-provider-return-type branch November 25, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant