Skip to content

Improves test suite performance by 8.5-25x [experiment!] - #22917

Draft
NickSdot wants to merge 24 commits into
php:masterfrom
NickSdot:perf/run-tests
Draft

Improves test suite performance by 8.5-25x [experiment!]#22917
NickSdot wants to merge 24 commits into
php:masterfrom
NickSdot:perf/run-tests

Conversation

@NickSdot

@NickSdotNickSdot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

While working on #22799 I was bothered by the test suite being so slow. CI needs ~45 minutes from push to finish; running tests locally also takes quite a while. I was wondering why that is and whether it must be like that. Hence, I decided to run an experiment to find out if we could make the developer experience notably better.

Note

This experiment was fully executed by Codex. I was throwing some money on OpenAI to let GPT 5.6 Sol pursue the /goal to make the test suite "massively" faster. This PR is the result of Codex trying exactly that -- for 14 hours straight. Consequently, I will not pretend that I understand the implications of every proposal -- and I also did not review everything in detail yet. Though, I did spend plenty of time to confirm the claims and reworking things.

The result are interesting enough to open this clearly flagged as LLM-executed experiment, hoping that it can serve as a discussion starter to find out whether anything can be picked up. Would love to get feedback from people with more experience than me, to pin down which of these are legit ideas and which are dead-ends right away.

Extracted PRs

All canges are now extracted to logical PRs as outlined below.

PRtitlestatus
#22957Run test subprocesses without shellmerged
#22939Run tests in parallel by defaultmerged
#22942Adds CLI test fork server for improved test suite performanceopen
#22944Cache failed PDO and SNMP service probesmerged
#22945Add bounded test directory concurrencyopen
#22946Select Windows test workers automaticallymerged
#22947Parallelize new_oom subprocessesopen
#22948Replace fixed test delays with deterministic synchronizationopen
#22949Make socket tests robust in restricted environmentsopen
#22950Reduce expensive test fixturesopen
#22995Improves CI performanceopen

Surfaced fixes extracted to separate PRs

PRtitlestatus
#22934Run scandir overflow test on Windows onlymerged
#22911Fixes leaked System V shared-memory segments in testsmerged
#22912Prevents tests from leaking System V IPC objectsmerged
#22952Fix redirected-test progress accounting in parallel runsmerged

Results

Values in seconds; measured on macOS. The full suite improvements are already awesome on their own. But targeted runs also show up to 25x faster results (-j10 vs. -j10), many at least 2x faster, and very few slightly slower.

flagmasterheregain
(none)2,223.22469.833-2,153.39 (31.84x)auto-detected concurrency by default
-j12,224.902443.214-1,781.69 (5.02x)optionally opting out of concurrency
-j10594.44569.768-524.68 (8.52x)

Misc

  • At first, I found it weird that it would propose adding test-only code to the SAPI. But then I learned that the already
    existing, internal --repeat flag does exactly that.
  • I am pretty sure that there are reasons for Windows in CI only running on -j2, and parallel not being the default. I, however, could not find out what these reasons are; hence, I kept changes Codex proposed.
  • not sure whether we fancy adding new phpt sections like MAX_CONCURRENCY, but it shows gains.

Reminders / Context

Can be ignored, just here for myself.

@NickSdot

Copy link
Copy Markdown
ContributorAuthor

Didn't expect this to be smooth in the very first CI run; will look into these.

@arnaud-lb

arnaud-lb commented Jul 29, 2026

Copy link
Copy Markdown
Member

Interesting work!

Related: #20980

Please submit each commit as a separate PR to make reviewing easier (maybe not all at once to avoid spamming the repos. Start with the most impacting ones). I will review at least some of them.

@NickSdot

Copy link
Copy Markdown
ContributorAuthor

Interesting work!

Related: #20980

Please submit each commit as a separate PR to make reviewing easier (maybe not all at once to avoid spamming the repos. Start with the most impacting ones). I will review at least some of them.

Thanks, Arnaud! Would you, for now, be fine with reviewing the individual commit diffs here? Like, so that we can pre-decide a few things here first, and based on that I am happily splitting up into individual PRs. The commits table in the PR desc brings you straight to the same diff you would have in a dedicated PR.

#20980 is indeed (admittedly naively) solved by this change. By decreasing batch size, much longer running batches get automatically more rare. Though, this is something that surely could be further improved in the future.

@NickSdot

Copy link
Copy Markdown
ContributorAuthor

Please submit each commit as a separate PR to make reviewing easier (maybe not all at once to avoid spamming the repos. Start with the most impacting ones). I will review at least some of them.

@arnaud-lb I stand corrected here. Didn't expect you commenting directly on the commits but here in the changes; my force pushes to keep the related changes all in one commit break the relation to the comments in that case. I already cherry picked #22939 and #22934. Will will follow up with more.

@NickSdot

Copy link
Copy Markdown
ContributorAuthor

@arnaud-lb

I will keep answering here for meta things not related to only one specific PR.

  1. The split into 10 logical PRs, plus one more fix, is done -- they are all linked in the description here. Didn't mark them all as ready for review yet and would appreciate if you could take a high level look at how things were split.
  2. I feel like I missed to answer one of your comments somewhere; if that's the case please hint me at it.
  3. Please let me know if any of the PRs need entries in NEWS, UPGRADING.INTERNALS or the like.

@NickSdotNickSdot mentioned this pull request Aug 3, 2026
@NickSdot

Copy link
Copy Markdown
ContributorAuthor

@arnaud-lb not sure if I should cc you in flakes like #23217 or #23225 that are likely surfaced by #22939; so I am asking one time here to find out if you want to be kept in the loop or not.

@arnaud-lb

Copy link
Copy Markdown
Member

@NickSdot yes feel free to ping me on these :)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@NickSdot@arnaud-lb